Two substrings
Level EASY
You are given a string s. Your task is to determine, if the given string s contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order). Print "yes" or "no".
The string s contains uppercase Latin letters only.
Input format :
Output format :
Constraints :
1 <= n (Length of String s) <= 10^5
Sample Input 1 :
Sample Output 1 :
Sample Input 2 :
Sample Output 2 :
Sample Input 3 :
Sample Output 3 :
no
Comments
Post a Comment
Please give us your valuable feedback