This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int main() {
cin >> n >> s;
//遍历每个字符
for (int i = 0; i < s.size(); i++) {
//s[i]遍历到的字符,s[i]+n就是目标字符,但是有可能是超过了'z'的
int c = s[i] + n;
//超过了z,该怎么办呢?
if (c > 'z') c = c - 'z' - 1 + 'a';
// if (c > 'z') c = c - 26;
//重新的放回到原来的数组位置上,生成新的字符串
s[i] = c;
//s[i] = (char) c;
}
cout << s << endl;
return 0;