1058: 电文保密
#include<iostream> #include<string> using namespace std; int main(){ string s; getline(cin,s); for(int i =0 ; i < s.length() ; i++) { if((s[i] >= 'a' && s[i]<'w') || (s[i] >= 'A' && s[i]<'W')) { // cout<<s[i]<<endl; s[i] += 4; // cout<<s[i]<<endl; } if((s[i] >= 'w' && s[i]<='z' )|| (s[i] >= 'W' && s[i]<='Z')) { s[i] += 4 - 26; } } cout<<s<<endl; return 0; }