Advertisement
Slyke

Untitled

Sep 14th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Scanner kb= new Scanner (System.in);
  2.  
  3. String inputString=kb.next();
  4.  
  5. boolean result=false;
  6.  
  7.  
  8. if (inputString.length() => 3) {
  9.   for (int i=0; i<inputString.length()-2; i++)
  10.   //Loop how ever many letters there are minus 2 times
  11.   {
  12.     if (inputString.substr(i,1)=="b" && inputString.substr(i+2,1)=="b") {
  13.       result=true;
  14.     }
  15.  
  16.   }
  17. } else {
  18.   result=false;
  19. }
  20. System.out.println(result);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement