using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static int minimumNumber(int n, string password) { // Return the minimum number of characters to make the password strong bool digit = false; bool lowercase = false; bool uppercase = false; bool specialCharacter = false; int counter = 0; do { if (!digit) { if (Char.IsDigit(password[counter])) { digit = true; goto label; } } if(!lowercase) { if (Char.IsLower(password[counter])) { lowercase = true; goto label; } } if(!uppercase) { if (Char.IsUpper(password[counter])) { uppercase = true; goto label; } } if(!specialCharacter) { if (IsSpecialCharacter(password[counter])) specialCharacter = true; } label: if (digit && lowercase && uppercase && specialCharacter) break; counter++; } while (counter < n); counter = 0; if (!digit) counter++; if (!lowercase) counter++; if (!uppercase) counter++; if (!specialCharacter) counter++; if ((n + counter) < 6) counter = 6 - n; return counter; } static bool IsSpecialCharacter(char ch) { char[] specialArray = { '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '+' }; for (int i = 0; i < specialArray.Length; i++) { if (ch == specialArray[i]) return true; } return false; } static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string password = Console.ReadLine(); int answer = minimumNumber(n, password); Console.WriteLine(answer); } }