(String[]args)
| 2 | class Solution |
| 3 | { |
| 4 | public static void main (String[]args) |
| 5 | { |
| 6 | Scanner sc = new Scanner (System.in); |
| 7 | int n = sc.nextInt (); |
| 8 | char arr[] = new char[n]; |
| 9 | for (int i = 0; i < n; i++) |
| 10 | arr[i] = sc.next ().charAt (0); |
| 11 | int lower[] = new int[26]; |
| 12 | int upper[] = new int[26]; |
| 13 | |
| 14 | for (int i = 0; i < n; i++) |
| 15 | { |
| 16 | if ((arr[i] >= 'A') && (arr[i] <= 'Z')) |
| 17 | upper[arr[i] - 'A']++; |
| 18 | else if ((arr[i] >= 'a') && (arr[i] <= 'z')) |
| 19 | lower[arr[i] - 'a']++; |
| 20 | } |
| 21 | boolean flag = false; |
| 22 | char ch = '\0'; |
| 23 | for (int i = 0; i < n; i++) |
| 24 | { |
| 25 | |
| 26 | if ((arr[i] >= 'A') && (arr[i] <= 'Z')) |
| 27 | { |
| 28 | |
| 29 | if (upper[arr[i] - 'A'] % 2 == 1) |
| 30 | |
| 31 | { |
| 32 | ch = (char) (arr[i]); |
| 33 | flag = true; |
| 34 | break; |
| 35 | } |
| 36 | } |
| 37 | else if ((arr[i] >= 'a') && (arr[i] <= 'z')) |
| 38 | { |
| 39 | if (lower[arr[i] - 'a'] % 2 == 1) |
| 40 | { |
| 41 | ch = (char) (arr[i]); |
| 42 | flag = true; |
| 43 | break; |
| 44 | } |
| 45 | |
| 46 | } |
| 47 | |
| 48 | } |
| 49 | if (flag == true) |
| 50 | System.out.println (ch); |
| 51 | else |
| 52 | System.out.println ("All are even"); |
| 53 | } |
| 54 | } |
nothing calls this directly
no outgoing calls
no test coverage detected