Shavit

Ex. Bank #31

Feb 25th, 2014
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. // Shavit Borisov
  2. // CW
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class StringStats {
  7.  
  8.     public static void main(String[] args)
  9.     {
  10.         Scanner in = new Scanner(System.in);
  11.         StringClass obj = new StringClass();
  12.        
  13.         String mostCommon = "";
  14.         String currentString;
  15.        
  16.         int palindromCounter = 0;
  17.        
  18.         System.out.printf("Keep entering strings. Stop the procedure with '*'");
  19.         currentString = in.next();
  20.        
  21.         while(!(currentString.equals("*")))
  22.         {
  23.             if(obj.isPalindrom(currentString))
  24.                 palindromCounter++;
  25.             mostCommon += obj.mostCommon(currentString);
  26.             currentString = in.next();
  27.         }
  28.        
  29.         System.out.printf("You've entered %d palindroms,  and you most common letter is %c", palindromCounter, obj.mostCommon(mostCommon));
  30.         in.close();
  31.     }
  32. }
Add Comment
Please, Sign In to add comment