Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int findMostWhitespace (Scanner scn)
- {
- String[] array = new String[3];
- for (int i = 0; i < array.length; i++) {
- array[i] = scn.nextLine();
- }
- String input = array[0];
- int spaces = 0;
- for (int i = 0; i < input.length(); i++) {
- if (Character.isWhitespace(input.charAt(i)))
- spaces++;
- }
- String input2 = array[1];
- for (int i = 0; i < input2.length(); i++) {
- if (Character.isWhitespace(input2.charAt(i)))
- spaces++;
- }
- String input3 = array[2];
- for (int i = 0; i < input3.length(); i++) {
- if (Character.isWhitespace(input3.charAt(i)))
- spaces++;
- }
- return spaces;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement