/* -*- coding: utf-8 -*- * * 1455.cc: No.1455 拡張ROTN - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100; const char w[] = "CpCzNkSuTbEoA"; /* typedef */ typedef long long ll; /* global variables */ char s[MAX_N + 4]; /* subroutines */ char cshift(char c, ll n) { if (c >= 'a' && c <= 'z') return (char)('a' + (c - 'a' + n) % 26); return (char)('A' + (c - 'A' + n) % 26); } /* main */ int main() { ll n; scanf("%s%lld", s, &n); for (int i = 0; s[i]; i++) { if (s[i] >= '0' && s[i] <= '9') { int di = s[i] - '0'; if (di + n < 10) putchar((char)(s[i] + n)); else { for (int j = 0; w[j]; j++) putchar(cshift(w[j], n - (10 - di))); } } else putchar(cshift(s[i], n)); } putchar('\n'); return 0; }