#include #include #include #include #include #include #include #include #include #include #include using namespace std; bool Includes(const string& x1, const string& x2) { for (auto character : x1) { for (auto ch : x2) { if (character == ch) return true; } } return false; } void Compute() { using namespace std; cin.sync_with_stdio(false); string numbers = "0123456789"; string lower_case = "abcdefghijklmnopqrstuvwxyz"; string upper_case = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; string special_characters = "!@#$%^&*()-+"; size_t length; cin >> length; string password; cin >> password; // It contains at least one digit: size_t toAdd = 0; if (!Includes(password, numbers)) { ++toAdd; } if (!Includes(password, lower_case)) { ++toAdd; } if (!Includes(password, upper_case)) { ++toAdd; } if (!Includes(password, special_characters)) { ++toAdd; } if (password.size() < 6) toAdd = std::max(6 - password.size(), toAdd); cout << toAdd << endl; } #if !defined(TEST) int main() { Compute(); return 0; } #endif