Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. using namespace std;
  5. string input,bomb,ans;
  6. int main() {
  7. cin>>input>> bomb;
  8. for(int i=0; i<input.size(); i++) {
  9. ans+=input[i];
  10. if(input[i]==bomb[bomb.size()-1] && i>=bomb.size()-1) {
  11. bool check=false;
  12. for(int j=0; j<bomb.size(); j++) {
  13. if(bomb[bomb.size()-j-1]!=ans[ans.size()-1-j])
  14. check=true;
  15. }
  16. if(check==false) {
  17. for(int i=0; i<bomb.size(); i++)
  18. ans.pop_back();
  19. }
  20. }
  21. }
  22. if(ans.size()==0) {
  23. cout<<"FRULA"<<endl;
  24. } else {
  25. cout<<ans<<endl;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement