| 5 | import java.util.Scanner; |
| 6 | |
| 7 | public class Problem16 { |
| 8 | |
| 9 | public static int getFactorial(int number) { |
| 10 | int factorial = 1; |
| 11 | |
| 12 | if (number == 0 || number == 1) { |
| 13 | return factorial; |
| 14 | } else { |
| 15 | for (int i = number; i >= 1; i--) { |
| 16 | factorial = factorial * i; |
| 17 | } |
| 18 | return factorial; |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | public static void main(String[] args) { |
| 23 | // TODO Auto-generated method stub |
| 24 | Scanner input = new Scanner(System.in); |
| 25 | String line; |
| 26 | int lineLength; |
| 27 | String[] lineInArray; |
| 28 | String[] lines; |
| 29 | |
| 30 | int N = input.nextInt(); |
| 31 | |
| 32 | while (N < 1) { |
| 33 | N = input.nextInt(); |
| 34 | } |
| 35 | |
| 36 | lines = new String[N]; |
| 37 | |
| 38 | for (int i = 0; i < N; i++) { |
| 39 | line = input.nextLine(); |
| 40 | |
| 41 | lineLength = line.trim().split("\\s+").length; |
| 42 | lineInArray = line.trim().split("\\s+"); |
| 43 | |
| 44 | boolean allFine = true; |
| 45 | |
| 46 | for (String word : lineInArray) { |
| 47 | if (word.length() < 1 || word.length() > 20) { |
| 48 | allFine = false; |
| 49 | break; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | while (lineLength < 1 || lineLength > 10 || allFine == false) { |
| 54 | line = input.nextLine(); |
| 55 | |
| 56 | lineLength = line.trim().split("\\s+").length; |
| 57 | lineInArray = line.trim().split("\\s+"); |
| 58 | |
| 59 | allFine = true; |
| 60 | |
| 61 | for (String word : lineInArray) { |
| 62 | if (word.length() < 1 || word.length() > 20) { |
| 63 | allFine = false; |
| 64 | break; |
nothing calls this directly
no outgoing calls
no test coverage detected