#include using namespace std; int minimumNumber(int n, string password) { // Return the minimum number of characters to make the password strong bool hasDigit = false; bool hasUpper = false; bool hasLower = false; bool hasSpecial = false; static string special_characters = "!@#$%^&*()-+"; for ( int i = 0; i < n; ++i ) { if ( !hasDigit && ( password[ i ] >= '0' && password[ i ] <= '9' ) ) { hasDigit = true; } if ( !hasLower && ( password[ i ] >= 'a' && password[ i ] <= 'z' ) ) { hasLower = true; } if ( !hasUpper && ( password[ i ] >= 'A' && password[ i ] <= 'Z' ) ) { hasUpper = true; } if ( !hasSpecial ) { for ( size_t j = 0; j < special_characters.size(); ++j ) { if ( password[ i ] == special_characters[ j ] ) { hasSpecial = true; break; } } } } int missing = 0; if ( !hasDigit ) { missing++; } if ( !hasLower ) { missing++; } if ( !hasUpper ) { missing++; } if ( !hasSpecial ) { missing++; } if ( n + missing < 6 ) { missing = 6-n; } return missing; } int main() { int n; cin >> n; string password; cin >> password; int answer = minimumNumber(n, password); cout << answer << endl; return 0; }