Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- string str;
- cin>>str;
- int pos1,pos2;
- pos1=str.find("AB");
- if(pos1!=-1)
- {
- str.erase(str.begin()+pos1,str.begin()+pos1+2);
- pos2=str.find("BA");
- if(pos2!=-1)cout<<"YES";
- else cout<<"NO";
- }
- else
- cout<<"NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement