题解 | #简单密码#
简单密码
https://www.nowcoder.com/practice/ff99c43dd07f4e95a8f2f5448da3772a
#include <stdio.h> #include <string.h> int main() { char str[201]; while(1) { gets(str); if(strcmp(str, "START")==0) continue; else if(strcmp(str, "END")==0) // continue; //else if(strcmp(str, "ENDOFINPUT")==0) break; int len=strlen(str); for(int i=0;i<len;i++) { if(str[i]>='F'&&str[i]<='Z') printf("%c",str[i]-5); else if(str[i]>='A'&&str[i]<='E') printf("%c",str[i]+21); else printf("%c",str[i]); } printf("\n"); } return 0; }
随便看看得了