Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- import java.util.Scanner;
- /**
- *
- * @author HRIDOY
- */
- public class main{
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- Scanner sc = new Scanner(System.in);
- int a,b;
- String s;
- s= sc.next();
- System.out.println(s);
- a=s.indexOf("AB");
- b=s.indexOf("BA");
- System.out.println(a+" "+b);
- if(a==(b+1) || b==(a+1)){
- System.out.println("NO");
- }else if(a== -1 && b== -1){
- System.out.println("NO");
- }
- else{
- System.out.println("YES");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement