#include <stdio.h>
int check(char s[])
{
int a , c , d , e , n , r ;
for(a = c = d = e = n = r = 0 ; s[n] ; n ++) {
if(s[n] >= '0' && s[n] <= '9') d = 1 ;
else if(s[n] >= 'A' && s[n] <= 'Z') c = 1 ;
else if(s[n] >= 'a' && s[n] <= 'z') a = 1 ;
else e = 1 ;
}
if(n > 5) {
if((a + c + d + e) == 1) r = 1 ;
else r = 2 ;
}
return r ;
}
int main(void)
{
char s[200][24] ;
int e , i , j , n ;
scanf("%d" , & n) ;
fflush(stdin) ;
for(i = 0 ; i < n ; i ++) {
for(j = 0 ; j < 20 && (s[i][j] = getchar()) != '\n' ; j ++) ;
s[i][j] = '\0' ;
}
for(i = 0 ; i < n ; i ++) {
e = check(s[i]) ;
if(! e) printf("Not Safe\n") ;
else if(e == 1) printf("Medium Safe\n") ;
else printf("Safe\n") ;
}
}
编译、运行实况:D:\00.Excise\C>g++ -o x x.c
D:\00.Excise\C>x
4
1234
abcdef
ABC123
1#c3Gh
Not Safe
Medium Safe
Safe
Safe
D:\00.Excise\C>
|