#include #include #include #include #include #include #include int isSpecial(char a) { char sp[15] = "!@#$%^&*()-+"; char *ptr = sp; while(*ptr) { if(*ptr==a) return 1; ptr++; } return 0; } int minimumNumber(int n, char* password) { // Return the minimum number of characters to make the password strong int num = 0; int lower = 0; int upper = 0; int special = 0; int len = strlen(password); char *ptr; ptr = password; while(*ptr) { if(*ptr>='0' && *ptr<='9') { num = 1; } else if(*ptr>='a' && *ptr<='z') { lower = 1; } else if(*ptr>='A' && *ptr<='Z') { upper = 1; } else if(isSpecial(*ptr)==1) { special = 1; } ptr++; } int count = 0; if(num==0) count++; if(lower==0) count++; if(upper==0) count++; if(special==0) count++; if(len<6) { if(count<6-len) count = 6-len; } return count; } int main() { int n; scanf("%i", &n); char* password = (char *)malloc(512000 * sizeof(char)); scanf("%s", password); int answer = minimumNumber(n, password); printf("%d\n", answer); return 0; }