SHARE
TWEET

ABBA

a guest May 20th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<cstdio>
  2. #include<sstream>
  3. #include<cstdlib>
  4. #include<cctype>
  5. #include<cmath>
  6. #include<algorithm>
  7. #include<set>
  8. #include<queue>
  9. #include<stack>
  10. #include<list>
  11. #include<iostream>
  12. #include<fstream>
  13. #include<numeric>
  14. #include<string>
  15. #include<vector>
  16. #include<cstring>
  17. #include<map>
  18. #include<iterator>
  19. #include <iomanip>
  20.  
  21. using namespace std;
  22.  
  23. // #include <ext/pb_ds/assoc_container.hpp>
  24. // #include <ext/pb_ds/tree_policy.hpp>
  25. // using namespace __gnu_pbds;
  26. // typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> ordered_set;
  27.  
  28.  
  29. int main()
  30. {
  31.     string s, t;
  32.  
  33.     cin>>s>>t;
  34.  
  35.  
  36.     while(t.size()>s.size())
  37.     {
  38.         if(t[t.size()-1]=='B')
  39.         {
  40.             t=t.substr(0,t.size()-1);
  41.             reverse(t.begin(),t.end());
  42.         }
  43.         else t=t.substr(0,t.size()-1);
  44.        
  45.     }
  46.    
  47.     if(s==t) cout<<"Possible"<<endl;
  48.     else cout<<"Impossible"<<endl;
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top