#include #include #include using namespace std; string numbers = "0123456789"; string lower_case = "abcdefghijklmnopqrstuvwxyz"; string upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string special_characters = "!@#$%^&*()-+"; bool isNumber( char c ) { return string::npos != numbers.find( c ); } bool isLower( char c ) { return string::npos != lower_case.find( c ); } bool isUpper( char c ) { return string::npos != upper_case.find( c ); } bool isSpecial( char c ) { return string::npos != special_characters.find( c ); } int minimumNumber(int n, string password) { // Return the minimum number of characters to make the password strong int count = 0; bool hasNum, hasLower, hasUpper, hasSpecial; hasNum = hasLower = hasUpper = hasSpecial = false; for( auto c: password ) { if( isNumber( c )) hasNum = true; if( isLower(c) ) hasLower = true; if( isUpper(c)) hasUpper = true; if( isSpecial( c ) ) hasSpecial = true; } if( !hasNum ) count ++; if( !hasLower ) count ++; if( !hasUpper ) count ++; if( !hasSpecial ) count ++; if( n >= 6 ) return count; return max( 6 - n , count ); } int main() { int n; cin >> n; string password; cin >> password; int answer = minimumNumber(n, password); cout << answer << endl; return 0; }