C

YONAGI 发表于 14天前 · 关联问题 一鸣师姐的期望

include<stdio.h>

include<string.h>

bool judge(char c[]){

int flag1=0; for(int i=0;i<strlen(c)+7;i++){ if(c[i]=='w'&&c[i+1]=='a'&&c[i+2]=='r'&&c[i+3]=='n' &&c[i+4]=='i'&&c[i+5]=='n'&&c[i+6]=='g'|| c[i]=='e'&&c[i+1]=='r'&&c[i+2]=='r'&&c[i+3]=='o' &&c[i+4]=='r') flag1++; } if(flag1==0)return true; else return false;

} int main(){

int T=0,n=0,flag=0; char c[1010]="\0"; scanf("%d",&T); for(int i=0;i<T;i++,flag=0){ scanf("%d",&n); getchar(); fgets(c,n+1,stdin); for(int h=1;h<27;h++){ for(int j=0;j<strlen(c);j++){ c[j]=((c[j]-96)+h-1)%26+97; } if(judge(c))flag++; if(flag)break; } if(flag)printf("0 error(s), 0 warning(s)\n"); else printf("Oops!\n"); memset(c,0,strlen(c));

} }