Advertisement
Underdogs

Untitled

Feb 28th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6.  
  7. import java.util.Scanner;
  8.  
  9. /**
  10. *
  11. * @author HRIDOY
  12. */
  13. public class main{
  14.  
  15. /**
  16. * @param args the command line arguments
  17. */
  18. public static void main(String[] args) {
  19. // TODO code application logic here
  20. Scanner sc = new Scanner(System.in);
  21. int a,b;
  22. String s;
  23. s= sc.next();
  24. System.out.println(s);
  25. a=s.indexOf("AB");
  26. b=s.indexOf("BA");
  27. System.out.println(a+" "+b);
  28. if(a==(b+1) || b==(a+1)){
  29. System.out.println("NO");
  30. }else if(a== -1 && b== -1){
  31. System.out.println("NO");
  32. }
  33. else{
  34. System.out.println("YES");
  35. }
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement