int main(){ char c; while((c=getchar()) != '\n'){ if((c>='A'&&c<='Z') || (c>='a'&&c<='z')){ c = c + 4; if(c>='Z' && c <='Z'+4 || c>'z') c = c - 26;//注意小写字母也满足这个条件,不加<‘Z’+4限制会出错,小写字母会-22 } printf("%c", c); } return 0; }