#include #include #include #include #include using namespace std; bool contains(string str, char what) { for(int i = 0; i < str.size(); i++) { if(what == str[i]) { // cout << "what(" << what << ")=str[i](" << str[i] << ")" << endl; return true; } else { // cout << "what(" << what << ")!=str[i](" << str[i] << ")" << endl; } } return false; } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n; cin >> n; string str; cin >> str; vector criterions; int quantity = 6; string numbers = "0123456789"; string lower_case = "abcdefghijklmnopqrstuvwxyz"; string upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string special_characters = "!@#$%^&*()-+"; for(int i = 0; i < 5; i++){ criterions.push_back(false); } if(n >= quantity) { criterions[0] = true; } for(int i = 0; i < n; i++) { if(!criterions[1]) { if(contains(numbers,str[i])) { criterions[1] = true; } } if(!criterions[2]) { if(contains(lower_case,str[i])) { criterions[2] = true; } } if(!criterions[3]) { if(contains(upper_case,str[i])) { criterions[3] = true; } } if(!criterions[4]) { if(contains(special_characters,str[i])) { criterions[4] = true; } } /* for(int i = 1; i < criterions.size(); i++) { cout << "criterions[" << i << "]=" << criterions[i] << endl; }*/ } int weakness = 0; for(int i = 1; i < criterions.size(); i++) { if(!criterions[i]) weakness++; } int neh = 0; if(criterions[0] == false) { neh = quantity-str.size(); if(neh < weakness) neh = weakness; } else { neh = weakness; } cout << neh << endl; return 0; }