题解 | #进制转换#
密码翻译
http://www.nowcoder.com/practice/136de4a719954361a8e9e41c8c4ad855
注意需要读取一行即可,因为字符串中有空格!
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
string s, ans;
while(getline(cin, s))
{
for(int i = 0; i < s.size(); i++)
{
char c = s[i];
if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
{
if(c == 'z') ans += 'a';
else if(c == 'z') ans += 'Z';
else{
ans += (c + 1);
}
}
else ans += c;
}
cout << ans << endl;
}
return 0;
}