Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- string input,bomb,ans;
- int main() {
- cin>>input>> bomb;
- for(int i=0; i<input.size(); i++) {
- ans+=input[i];
- if(input[i]==bomb[bomb.size()-1] && i>=bomb.size()-1) {
- bool check=false;
- for(int j=0; j<bomb.size(); j++) {
- if(bomb[bomb.size()-j-1]!=ans[ans.size()-1-j])
- check=true;
- }
- if(check==false) {
- for(int i=0; i<bomb.size(); i++)
- ans.pop_back();
- }
- }
- }
- if(ans.size()==0) {
- cout<<"FRULA"<<endl;
- } else {
- cout<<ans<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement