Problem:


Score : 200 points

Problem Statement

We have a string S consisting of uppercase English letters. Additionally, an integer N will be given.

Shift each character of S by N in alphabetical order (see below), and print the resulting string.

We assume that A follows Z. For example, shifting A by 2 results in C (A \to B \to C), and shifting Y by 3 results in B (Y \to Z \to A \to B).

Constraints

0 \leq N \leq 26

1 \leq |S| \leq 10^4

S consists of uppercase English letters.

Input

Input is given from Standard Input in the following format:

N
S

Output

Print the string resulting from shifting each character of S by N in alphabetical order.

Sample Input 1

2
ABCXYZ

Sample Output 1

CDEZAB

Note that A follows Z.

Sample Input 2

0
ABCXYZ

Sample Output 2

ABCXYZ

Sample Input 3

13
ABCDEFGHIJKLMNOPQRSTUVWXYZ

Sample Output 3

NOPQRSTUVWXYZABCDEFGHIJKLM



Sample input:
2
ABCXYZ


Sample output:
CDEZAB

Submission status: Accepted

Solution code:
n = int(input())
s = input()

alphabet = 'abcdefghijklmnopqrstuvwxyz'
alphabet = alphabet.upper()
alphabets = [w for w in alphabet]

words = []
for i in s:
    index = alphabets.index(i)
    new_index = index + n
    if new_index > 25:
        new_index -= 26
    words.append(alphabets[new_index])

ans = ''.join(words)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
for i in range(len(s)):
  if ord(s[i])+n <= ord("Z"): 
    print(chr(ord(s[i])+n), end="")
  else:
    print(chr(ord(s[i])+n-26), end="")   
print()

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())


num2alpha = lambda c: chr(c+64)
#0 ~ 25
alpha2num = lambda c: ord(c) - ord('A')

ans = [0] * len(S)
for i in range(len(S)):
  now = alpha2num(S[i]) + N
  now %= 26
  ans[i] = num2alpha(now + 1)
  
for i in range(len(S)):
  print(ans[i], end = "")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''

for i in s:
    ans += abc[(abc.index(i) + n )% 26]
    
print(ans)

Submission status: Accepted

Solution code:
import string
l = string.ascii_uppercase

N = int(input())
S = input()

ans = []
for c in S :
    plusNumber = (l.index(c) + N) % 26
    ans.append(l[plusNumber])
print("".join(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = input()
t = []
for i in range(len(s)):
    t.append(chr(((ord(s[i]) - ord('A')) + n) % 26 + 65))
print(''.join(t))

Submission status: Accepted

Solution code:
n = int(input())
a = ord('A')
s = [chr((ord(c) - a + n) % 26 + a) for c in input()]
print(''.join(s))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
'''
alp = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

for i in range(len(s)):
    s[i] = alp[(int(alp.index(s[i])) + n) % len(alp)]

print(''.join(s))
'''

for i in range(len(s)):
    s[i] = chr((ord(s[i]) + n - 65)%26 +65)

print(''.join(s))

Submission status: Accepted

Solution code:
N = int(input())
S = input()

T = ""
for s in S:
    a = ord(s) + N
    if a > ord("Z"):
        a -= 26
    T += chr(a)

print(T)

Submission status: Accepted

Solution code:
N = int(input())
S = input()

answer = ''
for i in range(len(S)):
    if ord(S[i]) + N > 90:
        answer += chr(ord(S[i]) + N - 26)
    else:
        answer += chr(ord(S[i]) + N)

print(answer)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
t = ''

for c in s:
    if ord(c) + n > ord('Z'):
        m = ord('Z') - ord(c)
        t += chr(ord('A') + (n - m - 1))
    else:
        t += chr(ord(c) + n)

print(t)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
A = []

for s in S:
  a = ord(s)+N
  if a<=90:
    A.append(chr(a))
  else:
    A.append(chr(64+(a-90)))
    
print(*A,sep="")

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())

ans = []

for s in S:
  ord_plus = ord(s)+N
  if ord_plus > 90:
    ord_plus -= 26
  ans.append(chr(ord_plus))
print("".join(ans))

Submission status: Accepted

Solution code:
n=int(input())
s=input()
ans=""
for i in range(len(s)):
  if ord(s[i])+n>ord("Z"):
    ans+=chr(ord(s[i])+n-26)
  else:
    ans+=chr(ord(s[i])+n)
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    S = list(input())

    ans = []
    for s in S:
        o = ord(s) + N
        if ord('Z') < o:
            o = o - ord('Z') + 64
        
        ans.append(chr(o))
    
    print("".join(ans))




if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
targ = ord("A")
n = int(input())
s = input()
ansl = []
for i in s:
  ansl.append(chr((ord(i)-targ+n)%26 + targ))
print("".join(ansl))

Submission status: Accepted

Solution code:
ans = ""
N = int(input())
S = str(input())
abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
M = len(abc)
for s in S:
    for i in range(M):
        if abc[i] == s:
            ans += abc[(i + N) % M]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
replace = []
for s in S:
    replace.append(chr((ord(s) - 65 + N) % 26 + 65))
print(''.join(replace))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())

ans = []
for s in S:
    w = ord(s)+N
    if w <= 90:
        ans.append(chr(w))
    else:
        ans.append(chr(w-26))
print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans = ''
for s in S:
	ans += chr(ord(s) + N) if ord(s) < (ord('Z') - N + 1) else chr(ord(s) - 26 + N)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()

base = ord("A")

ans = ""

for i in range(len(S)):
    p = (ord(S[i])-base)
    
    s = (p+N) % 26
    
    ans += chr(s+base)

print(ans)

Submission status: Accepted

Solution code:
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = int(input())
ss = input()
ans = ""
for s in ss:
    pos = alpha.index(s)
    pos = (pos + n) % 26
    ans += alpha[pos]
print(ans)

Submission status: Accepted

Solution code:
A = [c for c in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
N = int(input())
S = input()

s = ""
for c in S:
  new_index = (A.index(c) + N) % 26
  s += A[new_index]
  
print(s)

Submission status: Accepted

Solution code:
L=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
N=int(input())
S=list(input())
S=[L[L.index(i)+N] for i in S]
print("".join(S))

Submission status: Accepted

Solution code:
s="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
t={}
for i in range(26):
  t[s[i]]=i

n=int(input())
ss=input()
r=""
for i in ss:
  r+=s[(t[i]+n)%26]
print(r)

Submission status: Accepted

Solution code:
n=int(input())
s=str(input())
ans=""
for i in range(len(s)):
    x=ord(s[i])+n
    if x >90:
        x-=26
    ans+=chr(x)
print(ans)

Submission status: Accepted

Solution code:
import string

n = int(input())
s = input()

alpha = [chr(i) for i in range(65, 65+26)]
res = ""

for c in s:
    po = alpha.index(c)
    po = po + n
    if po > 25:
        po = po - 26
    res = res + alpha[po]
    
print(res)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
s=[]
for i in S:
    T=ord(i) - ord('A') + 1+N+64
    if T<=90:
        t=T
    else:
        t=T-26
    s.append(chr(t))
print(*s,sep='')

Submission status: Accepted

Solution code:
moji = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
memo = {}
for i in range(len(moji)):
    memo.setdefault(moji[i],i)
#print(memo)
n = int(input())
s = str(input())
ans = ''
for i in range(len(s)):
    ans += moji[(memo[s[i]]+n)%26]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()

ans=""
for i in range(len(s)):
    if ord(s[i])+n>90:
        ans+=chr(ord(s[i])+n-26)
    else:
        ans+=chr(ord(s[i])+n)

print(ans)

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    S = SS()

    ans = [chr((ord(i) - ord('A') + N) % 26 + ord('A')) for i in S]
    print(''.join(ans))

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
alpha = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
answer = ''
for i in range(len(S)):
    num = alpha.index(S[i])+N
    if num > 25:
        num -= 26
    answer += alpha[num]
print(answer)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
T='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=''
for s in S:
    ans+=T[T.index(s)+N-26]
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=str(input())
ls = []
for i in range(len(S)):
    ls.append(S[i])
for i in range(len(S)):
    x = S[i]
    #print(ord(x)+N,ord("Z"))
    if ord(x)+N > ord("Z"):
        #print("if")
        #print(ord("A")-ord("Z")+(ord(x)+N))
        ls[i]=chr(ord("A")-ord("Z")+(ord(x)+N)-1)
    else:
        #print("else")
        ls[i]=chr((ord(x)+N))
print("".join(ls))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())

t = []

for c in s:
    if ord(c) + n > ord("Z") :
        t.append(chr(ord("A") + (ord(c) + n - ord("Z") - 1)))
    else:
        t.append(chr(ord(c) + n))

print("".join(t))

Submission status: Accepted

Solution code:
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
INF =  float("inf")
import bisect

N = int(input())
S = input()

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

ans = ""
for i in range(len(S)):
    for j in range(26):
        if S[i] == alphabet[j]:
            k = (j+N) % 26
            ans += alphabet[k]
            break

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
for i in range(len(S)):
    index = ((ord(S[i]) + N) - 65) % 26 + 65
    print(chr(index), sep='', end='')

Submission status: Accepted

Solution code:
c = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(input())
str = input()
ans = ""
for i in range(len(str)):
  ans += c[c.index(str[i]) + N]
  
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
L=len(S)
Alph='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=''
for i in range(L):
  k=Alph.index(S[i])
  ans+=Alph[(k+N)%26]
print(ans)

Submission status: Accepted

Solution code:
def some():
    alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    n = int(input())
    s = input()
    result = ""
    for ch in s:
        index = (n + alphabets.index(ch))%26
        result += alphabets[index]
    return result

print(some())

Submission status: Accepted

Solution code:
n=int(input())
s=input()

p=len(s)

s_list=[]
for i in range(p):
    num=ord(s[i])+n
    if num>90:
        num-=26
    s_list.append(chr(num))

print("".join(s_list))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
a = ""
for ss in s:
    if ord('A') <= ord(ss) + n <= ord('Z'):
        a += chr(ord(ss) + n)
    else:
        a += chr(ord(ss) + n - ord('Z') + ord('A') - 1)
print(a)

Submission status: Accepted

Solution code:
n = int(input())
s = input()

ans = ''
for c in s:
    o = ord(c)
    if o+n > 90:
        ans += chr(o+n-26)
    else:
        ans += chr(o+n)

print(ans)

Submission status: Accepted

Solution code:
n=int(input(""))
sun=input("")
s=[]
ss="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in sun:
    if(i=="A"):
        s+=[0]
    elif(i=="B"):
        s+=[1]
    elif(i=="C"):
        s+=[2]
    elif(i=="D"):
        s+=[3]
    elif(i=="E"):
        s+=[4]
    elif(i=="F"):
        s+=[5]
    elif(i=="G"):
        s+=[6]
    elif(i=="H"):
        s+=[7]
    elif(i=="I"):
        s+=[8]
    elif(i=="J"):
        s+=[9]
    elif(i=="K"):
        s+=[10]
    elif(i=="L"):
        s+=[11]
    elif(i=="M"):
        s+=[12]
    elif(i=="N"):
        s+=[13]
    elif(i=="O"):
        s+=[14]
    elif(i=="P"):
        s+=[15]
    elif(i=="Q"):
        s+=[16]
    elif(i=="R"):
        s+=[17]
    elif(i=="S"):
        s+=[18]
    elif(i=="T"):
        s+=[19]
    elif(i=="U"):
        s+=[20]
    elif(i=="V"):
        s+=[21]
    elif(i=="W"):
        s+=[22]
    elif(i=="X"):
        s+=[23]
    elif(i=="Y"):
        s+=[24]
    elif(i=="Z"):
        s+=[25]
kk=""
for i in s:
    kk+=ss[(i+n)%26]
print(kk)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
L = len(S)

for i in range(L):
  S[i] = chr((ord(S[i])+N-65)%26+65)
  
print("".join(S))

Submission status: Accepted

Solution code:
x='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
from collections import Counter
c=Counter([])
for i in range(len(x)):
    c[x[i]]=i
n=int(input())
s=input()
ans=''
for i in range(len(s)):
    m=c[s[i]]
    ans+=x[(m+n)%26]
print (ans)

Submission status: Accepted

Solution code:
def main():
    from string import ascii_uppercase

    N = int(input())
    S = input()

    ans = ''
    for c in S:
        new_ind = (ascii_uppercase.index(c) + N) % 26
        ans += ascii_uppercase[new_ind]

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans=""
for i in range(len(S)):
    ans += chr((ord(S[i])+N+13)%26+52+13)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()

ans = ""
for i in range(len(S)):
    ord_c = ord(S[i])
    # print(chr((ord_c + N - 65) % 26 + 65))
    ans += chr((ord_c + N - 65) % 26 + 65)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
for i in range(len(s)):
    idx = ord(s[i]) - ord('A')
    s[i] = chr((idx + n) % 26 + ord('A'))
print("".join(s))

Submission status: Accepted

Solution code:
def main():
  n=int(input())
  s=input()
  ans=""
  for i in range(0,len(s)):
    ans+=chr(((ord(s[i])-ord('A')+n)%26)+ord('A'))
  print(ans)

main()

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
M = len(S)

A = [""]*M

for i in range(M):
    ref = 65 + (ord(S[i]) + N - 65) % 26
    A[i] = chr(ref)

ans = "".join(A)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
res = ""
for x in S:
    res += chr((ord(x) - ord("A") + N)%26 + ord("A"))
print(res)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
print(*[chr(65 + (ord(si) - 65 + n) % 26) for si in s], sep='')

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

n = int(input())
s = input()

for i in range(len(s)):
    temp = ord(s[i]) + n
    if (temp > 90):
        temp = 64 + (temp - 90)
    print(chr(temp), end="")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
q = [chr(i) for i in range(65,65+26)]
ans = []
for i in s:
  al = q.index(i)
  al += n
  if al >= 26:
    al -= 26
  print(q[al],end='')

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
res = ""

for i in S:
  for j in range(len(alphabet)):
    if i == alphabet[j]:
      res += alphabet[j + N]
      break
print(res)

Submission status: Accepted

Solution code:
n=int(input())
a=input()

for i in a:
  if ord(i)+n<=90:
    print(chr(ord(i)+n),end='')
  else:
    print(chr(ord(i)+n-26),end='')

Submission status: Accepted

Solution code:
n=int(input())
a=input()
b=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']


for i in a:
  print(b[b.index(i)+n],end='')

Submission status: Accepted

Solution code:
n = int(input())
s = input()

[print(chr((ord(s[i])+n-65)%26+65),end="") for i in range(len(s))]

Submission status: Accepted

Solution code:
n=int(input())
s=input()
ans=""
alp=[i for i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ"]
for i in s:
  ind=alp.index(i)
  ind+=n
  if 25<ind:
    ind=ind-26
  ans+=alp[ind]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=input()

abc='ABCDEFGHIJKLMNOPQRSTUVWXYZ'*2

ans=''
for i in s:
  inx=abc.index(i)
  inx+=n
  ans+=abc[inx]

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())

ans = ""

for i in range(len(S)):
  temp = ord(S[i])
  nxt = temp+N
  if nxt >= 91:
    nxt -= 26
  ans += chr(nxt)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
al='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=[]
s=input()
for i in range(len(s)):
  ans.append(al[(ord(s[i])-65+n)%26])
print(''.join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S = input()

for s in S:
    ans = ord(s) + N
    if ans > 90:
        ans -= 26
    print(chr(ans), end='')

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
S = list(input())

lis = []
for s in S:
    idx = ord(s)
    if idx+N>90:
        idx -= 26
    lis.append(chr(idx+N))
print(''.join(lis))

Submission status: Accepted

Solution code:
N = int(input())
S = input().strip()
N = N%26
x = ""
for i in range(len(S)):
    k = ord(S[i])
    j = (k-65+N)%26+65
    x += chr(j)
print(x)

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
ans = ""
for i in range(len(s)):
    x = ord(s[i])+n
    if x > ord("Z"):
        x = x-ord("Z")+ord("A")-1
    ans += chr(x)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
print(''.join([chr((ord(s) - ord('A') + N) % 26 + ord('A')) for s in S]))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans = ''
for c in S:
    i = ord(c) - ord('A')
    ans += chr(ord('A') + (i+N)%26)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()

Alpha = list('ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ')
ans = ''

for i in S:
  ans += Alpha[Alpha.index(i) + N]
  
print(ans)

Submission status: Accepted

Solution code:
# ABC146 B - ROT N
N = int(input())
S = str(input())
s=''
alp = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i in range(len(S)):
    t =alp.index(S[i])+N
    if t>=26:
        t -=26
    s += alp[t]
print(s)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

s = ""
for c in S:
    for i, a in enumerate(ABC):
        if a == c:
            break
    s += ABC[(i+N)%26]

print(s)

Submission status: Accepted

Solution code:
# abc146_b.py
# https://atcoder.jp/contests/abc146/tasks/abc146_b

# B - ROT N /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 英大文字のみからなる文字列 Sがあります。また、整数 Nが与えられます。
# Sの各文字を、アルファベット順で N個後の文字に置き換えた文字列を出力してください。
# ただしアルファベット順で Z の 1個後の文字は A とみなします。

# 制約
#     0≤N≤26
#     1≤|S|≤104
#     Sは英大文字のみからなる

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# S

# 出力
# Sの各文字を、アルファベット順で N個後の文字に置き換えた文字列を出力せよ。

# 入力例 1
# 2
# ABCXYZ

# 出力例 1
# CDEZAB

# アルファベット順で Z の 1個後の文字は A であることに注意してください。

# 入力例 2
# 0
# ABCXYZ

# 出力例 2
# ABCXYZ

# 入力例 3
# 13
# ABCDEFGHIJKLMNOPQRSTUVWXYZ

# 出力例 3
# NOPQRSTUVWXYZABCDEFGHIJKLM


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    S = lines[1]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    result = ''
    for char in S:
        result += shift_alp(char, N)

    return [result]


def shift_alp(s, n):
    alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

    for i in range(26):
        if alp[i] == s:
            return alp[(i+n) % 26]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2', 'ABCXYZ']
        lines_export = ['CDEZAB']
    if pattern == 2:
        lines_input = ['0', 'ABCXYZ']
        lines_export = ['ABCXYZ']
    if pattern == 3:
        lines_input = ['13', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']
        lines_export = ['NOPQRSTUVWXYZABCDEFGHIJKLM']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = ''
for i in s:
    next_number = ord(i)+n
    if next_number > 90:
        next_number -= 26
        ans += chr(next_number)
    else:
        ans += chr(next_number)
print(ans)

Submission status: Accepted

Solution code:

n = int(input())
a = input()
ans = ""
for i in a:
	ans += chr(65 + (ord(i) - 65 + n )%26)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()

ans = ''
for i in S:
    num = (ord(i) + N)
    if num > 90:
        num = 64 + num % 90
    ans += chr(num)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()

ans = ""
for i in s:
    t = ord(i)
    t += n
    if t > 90:
        t -= 26
    ans += chr(t)

print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import product, combinations,permutations
from copy import deepcopy
import sys
import numpy as np
sys.setrecursionlimit(4100000)



if __name__ == '__main__':
    N = int(input()) 
    S = input()
    Z = ord('Z')
    ans = ''
    for s in S:
        if ord(s)+N>ord('Z'):
            ans += chr(ord('A')+ord(s)+N-ord('Z')-1)
        else:
            ans += chr(ord(s)+N)
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
S = input()
a = ord('A')
z = ord('Z')
ans = ''
for s in S:
    if ord(s) + n <= 90:
        ans += chr(ord(s) + n)
    else:
        ans += chr(a + ord(s) + n - z - 1)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
S = input()
ans = ''
for s in S:
    if ord(s) + n <= 90:
        ans += chr(ord(s) + n)
    else:
        ans += chr(65 + ord(s) + n - 90 - 1)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()

chars = "abcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyz"
chars = chars.upper()
dic = {chars[i]: chars[i+N] for i in range(26)}
ans = ""
for i in range(len(S)):
    ans += dic[S[i]]

print(ans)

Submission status: Accepted

Solution code:
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alphabet = list(alphabet)
n = int(input())
s = input()
l = len(s)
for i in range(l):
    k = alphabet.index(s[i])
    print(alphabet[(k+n)%26], end = "")
print()

Submission status: Accepted

Solution code:
n=int(input());print(*[chr(ord(i)+n) if ord(i)+n<=90 else chr(ord(i)+n-26) for i in input()],sep='')

Submission status: Accepted

Solution code:
n = int(input())
s = list(map(ord, list(input())))
for i in range(len(s)):
  s[i] += n
  if s[i] > ord('Z'): s[i] -= 26
print("".join(map(chr,s)))

Submission status: Accepted

Solution code:
n = int(input())
S = input()
ans = ""
for s in S:
    tmp = ord(s) + n
    if tmp > 90:
        tmp -= 26
    ans += chr(tmp)
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()
S = input()
ans = ''

for m in S:
    ans += chr((ord(m) - 65 + N) % 26 + 65)

print(ans)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    S = list(input())
    ans = [chr(((ord(s)-65+N)%26)+65) for s in S]
    print("".join(ans))


if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

result = ""
for s in S:
  i = alpha.index(s)
  result += alpha[i+N]
print(result)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans=[]

for i in s:
  a = chr(ord('A')+(ord(i)-ord('A')+n)%26)
  ans.append(a)

print(('').join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
for i, char in enumerate(s):
    x = ord(char) + n
    if x > 90:
        x = x - 90 + 64
    s[i] = chr(x)

print("".join(s))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys


if len(sys.argv) == 2:
    sys.stdin = open(sys.argv[1])

N = int(input())
S = input()
T = ""
for ch in S:
    T += chr(ord('A') + (ord(ch) - ord('A') + N) % 26)
print(T)

Submission status: Accepted

Solution code:
n = int(input())
print(''.join(map(lambda x: chr((ord(x) + n + 13) % 26 + 65), input())))

Submission status: Accepted

Solution code:
from string import ascii_uppercase

N = int(input())
S = input()

num2alpha = {i: a for i, a in enumerate(ascii_uppercase)}
alpha2num = {a: i for i, a in enumerate(ascii_uppercase)}

ans = ""
for s in S:
    num = (alpha2num[s] + N) % 26
    ans += num2alpha[num]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
res = ""
for i in list(s):
  res += chr((ord(i) - ord('A')+n)%26+ord('A'))
  
print(res)

Submission status: Accepted

Solution code:
n = int(input())
s = list(map(ord, list(input())))
for i in range(len(s)):
  s[i] += n
  if s[i] > ord('Z'): s[i] -= 26
print("".join(map(chr,s)))

Submission status: Accepted

Solution code:
import sys

class alphabet: #Trueなら大文字
    def __init__(self, capitalize):
        self.num = dict() #アルファベットを数字に変換
        self.abc = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n"\
            ,"o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
        if capitalize: 
            for i in range(26): self.abc[i] = self.abc[i].upper()
        for i, a in enumerate(self.abc): self.num[a] = i


def solve():
    input = sys.stdin.readline
    N = int(input())
    S = input().strip("\n")
    Ans = ""
    Alphabet = alphabet(True)
    for i in range(len(S)):
        sNum = Alphabet.num[S[i]]
        rotateNum = (sNum + N) % 26
        Ans += Alphabet.abc[rotateNum]
    print(Ans)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = int(input())
s = input()
for c in s:
    for i in range(26):
        if alphabet[i] == c:
            print(alphabet[(i + n) % 26], end="")
print("")

Submission status: Accepted

Solution code:
N=int(input())
S=input()
ans=""
for x in range(len(S)):
  t=ord(S[x])+N
  if t>90:
    t-=26
  ans+=chr(t)
print(ans)

Submission status: Accepted

Solution code:
import copy
N = int(input())
S = input()
List=list(S)
newO = 0
NewList = copy.deepcopy(List)
res=""
for i in range(len(S)):
  newO = ord(List[i])+N
  if newO >=91:
    newO = newO-26
  NewList[i]=chr(newO)
for i in range(len(S)):
  res+=NewList[i]
print(res)

Submission status: Accepted

Solution code:
N = int(input())
S = input()

s = list(S)
for i in range(len(S)):
    if (ord(s[i]) - 64 + N) % 26 == 0:
        p = 90
    else:
        p = (ord(s[i]) - 64 + N) % 26 + 64

    s[i] = chr(p)

print("".join(s))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alphabet = 'abcdefghijklmnopqrstuvwxyz'.upper()
ans = ''
for s in S:
    next = (alphabet.index(s)+N) % 26
    ans += alphabet[next]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()

A = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

ans = ''
for s in S:
  ans += A[(A.index(s)+N)%26]

print(ans)

Submission status: Accepted

Solution code:
import sys
import string
N = int(input())
S = input()
s = list(S)
array = string.ascii_uppercase

for I in s:
    if array.index(I) + N <= 25:
        print(array[array.index(I) + N],end='')
    else:
        print(array[(array.index(I) + N) - 26],end='')

Submission status: Accepted

Solution code:
import sys
import string
N = int(input())
S = input()
s = list(S)
array = string.ascii_uppercase

if not ( 0 <= N <= 26 ): sys.exit()
if not ( 1 <= len(s) <= 10**4 ): sys.exit()
if not S.isupper(): sys.exit()

for I in s:
    if array.index(I) + N <= 25:
        print(array[array.index(I) + N],end='')
    else:
        print(array[(array.index(I) + N) - 26],end='')

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
a = []
for i in s:
    num = ord(i)+n
    if num > 90:
        num -= 26
    a.append(chr(num))
print(''.join(a))