// // main.cpp // hackerrank1 // // Created by Alex Mazalov on 02/11/2017. // Copyright © 2017 Alvis Internet Solutions Ltd. All rights reserved. // /* #include int main(int argc, const char * argv[]) { // insert code here... std::cout << "Hello, World!\n"; return 0; } */ //#include #include #include #include #include using namespace std; int minimumNumber(int n, string password) { string numbers = "0123456789"; string lower_case = "abcdefghijklmnopqrstuvwxyz"; string upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string special_characters = "!@#$%^&*()-+"; int digit = 1; int lc = 1; int uc = 1; int specialC = 1; for (int i = 0; i < n; i++) { if (numbers.find(password[i]) != std::string::npos) { digit = 0; } if (lower_case.find(password[i]) != std::string::npos) { lc = 0; } if (upper_case.find(password[i]) != std::string::npos) { uc = 0; } if (special_characters.find(password[i]) != std::string::npos) { specialC = 0; } } return max(digit + lc + uc + specialC, (int)(6-password.length())); } int main() { int n; cin >> n; string password; cin >> password; int answer = minimumNumber(n, password); cout << answer << endl; return 0; }