| 31 | // The solution function to check the validity of the entered password is correct or not. |
| 32 | |
| 33 | void solve() |
| 34 | { |
| 35 | String numbers = "0123456789", |
| 36 | lower_case = "abcdefghijklmnopqrstuvwxyz", |
| 37 | upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", |
| 38 | special_characters = "!@#$%^&*()-+"; |
| 39 | int n = ni(); |
| 40 | char[] s = ns(n); |
| 41 | int need = 0; |
| 42 | int x = 0; |
| 43 | for(char c : s){ |
| 44 | if(numbers.indexOf(c) >= 0)x |= 1; |
| 45 | if(lower_case.indexOf(c) >= 0)x |= 2; |
| 46 | if(upper_case.indexOf(c) >= 0)x |= 4; |
| 47 | if(special_characters.indexOf(c) >= 0)x |= 8; |
| 48 | } |
| 49 | need = 4-Integer.bitCount(x); |
| 50 | out.println(Math.max(6-n, need)); |
| 51 | } |
| 52 | |
| 53 | void run() throws Exception |
| 54 | { |