Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class StringStats {
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- StringClass obj = new StringClass();
- String mostCommon = "";
- String currentString;
- int palindromCounter = 0;
- System.out.printf("Keep entering strings. Stop the procedure with '*'");
- currentString = in.next();
- while(!(currentString.equals("*")))
- {
- if(obj.isPalindrom(currentString))
- palindromCounter++;
- mostCommon += obj.mostCommon(currentString);
- currentString = in.next();
- }
- System.out.printf("You've entered %d palindroms, and you most common letter is %c", palindromCounter, obj.mostCommon(mostCommon));
- in.close();
- }
- }
Add Comment
Please, Sign In to add comment