#include #include #include #include #include #include #include int minimumNumber(int n, char* pass) { // Return the minimum number of characters to make the password strong char a[100] = "!@#$%^&*()-+"; char b[100] = "0123456789"; char c[100] = "abcdefghijklmnopqrstuvwxyz"; char d[100] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int c1= 0,i, j, c2 = 0, c3 = 0, c4 = 0; for(i = 0; i < n; i++) { for(j = 0; j < 12; j++) { if(pass[i] == a[j]) { c1 = 1; } } for(j = 0; j < 26; j++) { if(pass[i] == c[j]) { c2 = 1; } } for(j = 0; j < 12; j++) { if(pass[i] == d[j]) { c3 = 1; } } for(j = 0; j < 10; j++) { if(pass[i] == b[j]) { c4 = 1; } } } int count = 0; int x = 6; if(c1 != 1) count++; if(c2 != 1) count++; if(c3 != 1) count++; if(c4 != 1) count++; int len = strlen(pass); // int len1 = x - len; len = len + count; if(len >= 6) return count; // printf("%d", len1); if(len < 6) { return x - len + count; } return count; } int main() { int n; scanf("%i", &n); char* pass = (char *)malloc(512000 * sizeof(char)); scanf("%s", pass); int answer = minimumNumber(n, pass); printf("%d\n", answer); return 0; }