#include using namespace std; const string numbers = "0123456789"; const string lower_case = "abcdefghijklmnopqrstuvwxyz"; const string upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const string special_characters = "!@#$%^&*()-+"; int minimumNumber(int n, string password) { // Return the minimum number of characters to make the password strong int result = 4; bool numberContains = false; bool upperContains = false; bool lowerContains = false; bool specialContains = false; for (int i = 0;i < password.size ();++i){ if (!numberContains && numbers.find (password [i]) != string::npos){ numberContains = true; result--; } else if (!lowerContains && lower_case.find (password [i]) != string::npos){ lowerContains = true; result--; } else if (!upperContains && upper_case.find (password [i]) != string::npos){ upperContains = true; result--; }else if (!specialContains && special_characters.find (password [i]) != string::npos){ specialContains = true; result--; } } if (password.size () + result < 6){ result += 6 - password.size () - result; } return result; } int main() { int n; cin >> n; string password; cin >> password; int answer = minimumNumber(n, password); cout << answer << endl; return 0; }