这里 k 取1
#include <cctype>
#include <string>
#include <iostream>
using namespace std
;
int main()
{
string s
;
getline(cin
, s
);
for (int i
= 0; i
< s
.size(); i
++) {
if (isalpha(s
[i
])) {
if (islower(s
[i
])) {
s
[i
] = char((s
[i
] + 1 - 'a') % 26 + 'a');
cout
<< s
[i
];
}
else {
s
[i
] = char((s
[i
] + 1 - 'A') % 26 + 'A');
cout
<< s
[i
];
}
} else
cout
<< s
[i
];
}
cout
<< endl
;
return 0;
}
转载请注明原文地址:https://blackberry.8miu.com/read-44507.html