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()

a=['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']
anslist=[]

for i in range(len(S)):
    b=a.index(S[i])
    anslist.append(a[b+N])

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

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
65 - 90
A = []
for i in range (65, 91):
  A.append(chr(i))
A *= 2
for j in range (len(S)):
  k = A.index(S[j])
  S[j] = A[k+N]
L = ''
for m in S:
  L += m
print(L)

Submission status: Accepted

Solution code:
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"]*2
N = int(input())
S = list(input())
for i in range(len(S)):
	Anum = Alp.index(S[i])
	S[i] = Alp[Anum+N]
print("".join(S))

Submission status: Accepted

Solution code:
n=int(input())
s=input()
k=len(s)
x='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
l=[]
y=0
for i in range(k):
    y=x.index(s[i])
    if y+n<25:
        l.append(x[y+n])
    else:
        l.append(x[y+n-26])
l=''.join(l)
print(l)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
b=""
a=["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)):
   for j in range(26):
       if s[i]==a[j]:
           b+=a[j+n-26]
print(b)

Submission status: Accepted

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

ans = ''
for i in S:
    if ord(i) + N <= 90:
        ans += chr(ord(i)+N)
    else:
        ans += chr(-90 + ord(i) +N +64)

print(ans)

Submission status: Accepted

Solution code:
arb='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
ans =''
for i in range(len(S)):
    if arb.index(S[i]) + N +1 <= len(arb):
        ans += arb[arb.index(S[i])+N]
    else:
        ans += arb[-len(arb) + arb.index(S[i]) + N]
print(ans)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    s = list(input())
    string = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'*2)
    for i in range(len(s)):
        s[i] = string[string.index(s[i])+n]
    print(*s, sep='')
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

d = ""
for i in range(len(s)):
  a = ord(s[i])+n
  if a <= ord("Z"):
    d = d + chr(a)
  else:
    d = d + chr(a - (ord("Z")-ord("A"))-1)
    
print(d)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    s = input()
    reps = ''
    for c in s:
        asc = (ord(c) + n - 65) % 26 + 65
        reps += chr(asc)
    print(reps)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    s = input()
    reps = ''
    for c in s:
        asc = ord(c) + n
        if asc > 90:
            reps += chr(64 + asc - 90)
        else:
            reps += chr(asc)
    print(reps)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
def change_n(s,n) :
    ans = ""
    for i in s :
        ans +=chr( ord("A") + ((ord(i) - ord("A") + n) %26) )
    
    return ans


N = int(input())
S = list(input())
print(change_n(S,N))

Submission status: Accepted

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

print(S)

Submission status: Accepted

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

print(S)

Submission status: Accepted

Solution code:
CONST='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
n=int(input())
s=list(input())
news=''
for si in s:
  news += CONST[CONST.index(si)+n]
print(news)

Submission status: Accepted

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

ans = ''
for i in S:
  chatonum = lambda i: ord(i) - ord('A') + 1
  num = chatonum(i)
  num += N
  if 26 < num:
    num -= 26
  numtocha = lambda num: chr(num+64)
  cha = numtocha(num)
  ans += cha
  
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

print(t)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
for s in S:
    ans = chr((ord(s) - ord("A") + N) % 26 + ord("A"))
    print(ans,end="")

Submission status: Accepted

Solution code:
n = int(input())
st = ["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"]
s = input()
for i in range(len(s)):
    a = (st.index(s[i]) + n) % 26
    print(st[a],end="")

Submission status: Accepted

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

plain = ""
for char in list(s):
    ASCII = ord(char)
    num = ASCII -65
    num = (num + n) % 26
    ASCII = num + 65
    plain += chr(ASCII)
print(plain)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

out = ''

for s in S:
    if ord(s) + N > 90:
        out = out + chr(64 + (ord(s) + N - 90))
    else:
        out = out + chr(ord(s) + N)

print(out)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
s = input()

alp = [chr(i) for i in range(65,65+26)]
ind = np.arange(len(alp))

dic = dict(zip(alp, ind))

st = ''
for m in s:
    idx = dic[m]
    idx = (idx+n) % 26
    st += alp[idx]

print(st)

Submission status: Accepted

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

ans = ''
for char in s:
    ans += chr(ord(char) + n if ord(char) + n < 91 else 65 + (ord(char) + n - 91))
print(ans)

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
s = S()
AZ = string.ascii_uppercase
ans = []
for c in s:
    i = (AZ.index(c) + N)%26
    ans += AZ[i]
print(''.join(ans))

Submission status: Accepted

Solution code:

from string import ascii_uppercase

char_idx = {char:i for i, char in enumerate(ascii_uppercase)}

n = int(input())
s = input().rstrip()
res = "".join(ascii_uppercase[(char_idx[char] + n) % 26] for char in s)
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

ans = list(map(ord, S))
for i in range(len(ans)):
    ans[i] = ans[i] + N
    if ans[i] > ord("Z"):
        ans[i] = ans[i] - 26

for ans in ans:
    print("".join(chr(ans)), end="")

Submission status: Accepted

Solution code:
n=int(input())
s=input()
ans=''
for t in s:
        ord_t=ord(t)
        ord_t+=n
        if(ord_t>ord('Z')):
                ord_t-=26
        ans+=chr(ord_t)
print(ans)

Submission status: Accepted

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

for i in range(len(S)):
    a = ord(S[i]) + N
    if a > 90:
        S[i] = chr(64 + a % 90)
    else:
        S[i] = chr(a)
print(''.join(S))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
for i in s:
    k = ord(i)+n
    print(chr(k-(k>ord("Z"))*26),end= "")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
al = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for i in range(len(s)):
    ans += (al[al.index(s[i]) - 26 + n])

print(ans)

Submission status: Accepted

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

p = ord("Z") - ord("A")
for i in range(len(S)):
  k = ord(S[i]) + n
  if k > ord("Z"):
    S[i] = chr(ord(S[i])+n-p-1)
  else:
    S[i] = chr(ord(S[i])+n)
    
print("".join(S))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
S_num=[ord(S[i]) for i in range(len(S))]
S_str=''
for i in range(len(S)):
  S_num[i]=int(S_num[i])+N
  if S_num[i]>=91:
    S_num[i]=S_num[i]-26
  S_str+=chr(S_num[i])
print(S_str)

Submission status: Accepted

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

ordA = ord('A')

ans = ''
for s in S:
  s = ord(s) - ordA
  ans += chr(ordA + (s + n) % 26)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    n = int(input())
    s = input().rstrip()
    first = ord("A") - 1
    last = ord("Z")
    increment = lambda x: chr(ord(x)+n) if ord(x)+n <= last else chr(first + (ord(x)+n - last))
    new_s = "".join(map(increment, s))
    print(new_s, end="")
    


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

alpha2num = lambda x: ord(x) - ord('A') + 1
num2alpha = lambda x: chr(x+64)

for i in range(L):
    num = alpha2num(LS[i]) + N
    if num <= 26:
        LS[i] = num2alpha(num)
    else:
        LS[i] = num2alpha(num-26)

print(''.join(LS))

Submission status: Accepted

Solution code:
n=int(input())
s=input()
k=len(s)
alp='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
a=''
for i in s:
  a+=alp[(alp.index(i)+n)%26]
print(a)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
# ord()もchr()も一文字の変換を想定しているから空文字をfor文で結合
# 元の文字コードポイントにN加えた整数を26で割った余りを、'A'のコードポイントに足し合わせる
print(''.join(chr((ord(c) - ord('A') + N) % 26 + ord('A')) for c in S))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())
s = input()
ans=""
for _ in s:
    num = ord(_)+n
    if 90 < num:
        num -= 26
    ans+=chr(num)
print(ans)
# print(ord("A"))
# print(ord("Z"))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - ROT N
https://atcoder.jp/contests/abc146/tasks/abc146_b

"""
import sys


from string import ascii_uppercase

def solve(N, S):
    t = ascii_uppercase[N:] + ascii_uppercase[:N]
    return S.translate(str.maketrans(ascii_uppercase, t))


def main(args):
    N = int(input())
    S = input()
    ans = solve(N, S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

ans = ""
for si in s:
    buf = ord(si) + n
    if buf > ord("Z"): buf += ord("A") - ord("Z") - 1
    ans += chr(buf)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
Ans = []
for s in S:
    a = ord(s) + N
    while a > 90:
        a -= 26
    Ans.append(chr(a))

print(''.join(Ans))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
t = []
for S in s:
    if ord(S) + n <= 90:
        t.append(chr(ord(S) + n))
    else:
        t.append(chr(ord(S) + n - 26))
print("".join(t))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
Z=[]
count=len(S)

for i in range(count):
    tmp=ord(S[i])
    if tmp+N>90:
        tmp=tmp+N-26
    else:
        tmp+=N
    Z.append(chr(tmp))


L=[str(a) for a in Z]
L="".join(L)
print(L)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
T = ['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)):
  idx = T.index(S[i])
  idx += N
  if idx > len(T)-1:
    idx = idx-len(T)
    S[i] = T[idx]
  else:
    S[i] = T[idx]
print(''.join(S))

Submission status: Accepted

Solution code:
def actual(n, s):
    # 方針: 0->25 の世界で nだけシフトさせる → 65-90の世界に復元
    answer = ''

    ord_A = ord('A')

    for char in s:
        x = ord(char) - ord_A  # Aが0になるように初期化する
        y = (x + n) % 26  # mod 26 で 26パターンに分類できる
        z = y + ord_A  # 復元できるように補正する

        answer += chr(z)

    return answer


n = int(input())
s = input()
 
print(actual(n, s))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = input()
    result = ""
    for i in S:
        ch = ord(i)
        if ch + N > 90:
            result += chr(ch - 90 + N + 64)
        else:
            result += chr(ch + N)

    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in s:
    ch=ord(i)
    if ch+n>90:
        ans+=chr(97+ch+n-123)
    else:
        ans+=chr(ch+n)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
r = ""
S = input()
for s in S:
    m = ord(s)+n
    if m > ord("Z"):
        m -= 26
    r += chr(m)
print(r)

Submission status: Accepted

Solution code:
import string

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

string_list = list(string.ascii_uppercase)

for i in S:
    if string_list.index(i) + N <=25:
        print(string_list[string_list.index(i) + N ], end='')
    else:
        print(string_list[string_list.index(i) + N  - 26], end='')

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    S = input()
    abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    ans = ""
    for i in range(len(S)):
        ans += abc[(abc.index(S[i])+N)%26]
    print(ans)
resolve()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
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']
ans = ''
for i in range(len(s)):
  ans += abc[(abc.index(s[i]) + n) % 26]
print(ans)

Submission status: Accepted

Solution code:
alf = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'

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

for i in range(len(S)):
    for j in range(26):
        if S[i] == alf[j]:
            S[i] = alf[j + N]
            break

ans = ''.join(S)

print(ans.upper())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def rotn(n, s):

    ans = ""

    for i in s:
        ans += chr(ord("A")+(ord(i)+ n-ord("A"))%26)

    return ans

def main():
    n = int(input())
    s = list(str(input()))
    print(rotn(n, s))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

def main():
    N = int(input())
    S = input()
    ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    print("".join([ABC[(ABC.find(c) + N) % 26] for c in S]))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ROT = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2
N = int(input())
S = input()
def rot(ROT, N, c):
  return ROT[ROT.find(c)+N]
print("".join(rot(ROT, N, c) for c in S))

Submission status: Accepted

Solution code:
import sys
import decimal # 10進法に変換，正確な計算

def input():
    return sys.stdin.readline().strip()

def main():
    n = int(input())
    s = list(input())
    al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    l = len(s)
    for i in range(l):
        for k in range(26):
            if s[i] == al[k]:
                if k + n > 25:
                    s[i] = al[k+n-26]
                    print(s[i], end="")
                else:
                    s[i] = al[k+n]
                    print(s[i], end="")
                break
    
    
main()

Submission status: Accepted

Solution code:
import string
N = int(input())
S = input()
ans = ""

for char in S:
    x = ord(char) + N
    if x > 90:
        x = 64 + x % 90
    ans += chr(x)

print(ans)

Submission status: Accepted

Solution code:
R=["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())
A=list(input())
for i in range(len(A)):
  A[i]=R[(R.index(A[i])+N)%26]
print("".join(A))

Submission status: Accepted

Solution code:
R=["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())
A=list(input())
for i in range(len(A)):
  A[i]=R[(R.index(A[i])+N)%26]
print("".join(A))

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**5)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    s = gete()

    def shift(c, k):
        ret = ord(c) + k
        if ret > ord('Z'): ret = ord('A') + ret - ord('Z') - 1
        return chr(ret)

    print("".join([shift(c, n) for c in s]))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

s = input()
list = [chr(ord('A') + i) for i in range(26)]
kekka = []
for i in range(len(s)):
    result = (list.index(s[i]) + n)%26
    kekka += list[result]

print("".join(kekka))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(s)):
    #print(ord(s[i]))
    ans.append(chr((ord(s[i])+n-65)%26+65))

print("".join(ans))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans=''
for i in range(len(S)):
    ans=ans+alphabet[(alphabet.find(S[i])+N)%26]

print(ans)

Submission status: Accepted

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

ans = ''
for s in S:
    ans += chr((ord(s)+n - 65)%26+65)
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
s = list(input())
s = list(map(lambda x: ord(x), s))
for i in range(len(s)):
    if s[i] + n > 90:
        s[i] = s[i] + n - 90 + 64
    else:
        s[i] = s[i] + n
s = list(map(lambda x: chr(x), s))
print(''.join(s))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
l = len(S)
ans = ''
for i in S:
    num = ord(i)
    num += N
    if num > 90:
        num = 65 + num % 90 -1
    ans += chr(num)
print(ans)

Submission status: Accepted

Solution code:
#ord('A') , ord('Z') (65, 90)
n = int(input())
s = input()
#n = 2
#s = 'ABCXYZ'

ans = ''
for i in s:
  x = ord(i) + n
  if x > 90:
    x = 65 + x % 90 -1
  ans += chr(x)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
List=list(s)
for i in range(len(s)):
    if ord(List[i])+n<=90:
        List[i]=chr(ord(List[i])+n)
    else:
        List[i]=chr(ord(List[i])+n-26)
new_s="".join(List)
print(new_s)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
S = ''
for i in s:
  m = n % 26
  ascii_n = ( ord(i) + m)
  if ascii_n > 90:
    ascii_n -= 26
  S+=(chr(ascii_n))
print(S)

Submission status: Accepted

Solution code:
ordA = ord('A')

N = int(input())
Ss = input().rstrip()

anss = ''
for S in Ss:
    S = ord(S) - ordA
    anss += chr(ordA + (S+N)%26)

print(anss)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ns =''
for i in range(len(s)):
    ns += chr((ord(s[i]) - 65 + n) % 26 + 65)
print(ns)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ns =''
for i in range(len(s)):
    if ord(s[i]) + n < 91:
        ns += chr(ord(s[i]) + n)
    else:
        ns += chr(ord(s[i]) + n - 26)
print(ns)

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
apple = "ZABCDEFGHIJKLMNOPQRSTUVWXY"
orange = dict()
cat = dict()
snow = []
for i, j in zip(range(26), apple):
    orange[i] = j
    cat[j] = i

for i in s:
    num = cat[i]
    dog = (num + n) % 26
    snow.append(orange[dog])
print("".join(snow))

Submission status: Accepted

Solution code:
N = int(input().rstrip())
S = input().rstrip()
ans = list(S)
for i in range(len(S)):
    ans[i] = chr(65+(ord(S[i])+N)%65%26)
print(''.join(ans))

Submission status: Accepted

Solution code:
n=int(input())
m=input()
alf=["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"]
ans=""
for i in m:
    for j in alf:
        if i==j:
            ans=ans+alf[alf.index(j)+n]
            break

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def main():
    n = ri()
    s = input()
    ns = ""
    for c in s:
        ns += alp[(ord(c)-ord('A')+n)%26]
    print(ns)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ANS = ''
for s in S:
    if ord(s) + n <= ord('Z'):
        ANS += chr(ord(s) + n)
    else:
        ANS += chr(ord(s) + n -26)
print(ANS)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys

INF = float('inf')
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]


n = I()
s = S()
ans = ''
for c in s:
    if ord(c) + n > ord('Z'):
        ans += chr((ord(c) + n) - ord('Z') + ord('A') - 1)
    else:
        ans += chr(ord(c) + n)
print(ans)

Submission status: Accepted

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

lis = list()
for i in range(len(S)):
    if (ord(S[i]) + N) > 90:
        lis.append(chr(ord(S[i]) +N - 26))
    else:
        lis.append(chr(ord(S[i]) + N))

ans =""

for x in lis:
    ans += x

print(ans)

Submission status: Accepted

Solution code:
import string

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

lis = string.ascii_uppercase*2

ans =""
for i in s:
    tmp = lis.index(i) + n
    ans += lis[tmp]
    
print(ans)

Submission status: Accepted

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

alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

for a in s:
  idx = alphabet.index(a) + n
  print(alphabet[idx], end='')

Submission status: Accepted

Solution code:
n = int(input().rstrip())
cl = [ord(c) for c in input().rstrip().rstrip()]
for i in range(len(cl)):
	v = cl[i] + n
	cl[i] = v if v <= ord('Z') else (ord('A') + v - ord('Z') - 1)

r = ''
for i in range(len(cl)):
	r += chr(cl[i])

print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n = int(input())
s = input()
ans = ''
for i in s:
    ans += a[(a.index(i) + n) % 26]
print(ans)

Submission status: Accepted

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

ord_S = list(map(ord, S))

ord_shift_S = [(x+N - ord('A'))%26 + ord('A') for x in ord_S]
chr_shift_S = list(map(chr, ord_shift_S))

print(*chr_shift_S, sep='')

Submission status: Accepted

Solution code:
l = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2
n = int(input())
print("".join([l[l.index(x)+n] for x in input()]))

Submission status: Accepted

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

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def rot(s, N):
    p = ord(s) - ord('A')
    p = (p + N) % 26
    return chr(ord('A') + p)


def main():
    N = int(readline())
    S = readline().rstrip().decode()
    print(''.join([rot(s, N) for s in S]))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
k = int(raw_input())
A = 'A'
print ''.join([chr((ord(l) -ord(A) + k) % 26 + ord(A))  for l in raw_input()])

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    S = list(input())

    ai = ord('A')
    zi = ord('Z')
    for i in range(len(S)):
        code = ord(S[i]) + N
        if code > zi:
            code -= 26
        S[i] = chr(code)

    print(''.join(S))


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

m= len(s)
alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

new=''


for i in range(m):
    num = alph.index(s[i])
    new += alph[num+n]

print(new)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
S=""
for i in range(len(s)):
	S+=chr((ord(s[i])+n-65)%26+65)
print(S)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans = ""
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"]
for i in range(len(S)):
    index = l.index(S[i])
    if index + N >= 26:
        ans += l[index+N-26]
    else:
        ans += l[index+N]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    s = input()[:-1].decode()

    ans = ''

    for si in s:
        ans += chr(ord('A') + (ord(si) - ord('A') + n) % 26)

    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

Solution code:
import string
a = string.ascii_uppercase*2
N = int(input())
S = input()
b = []
for i in S:
    b.append(a[a.index(i)+N])
print("".join(b))

Submission status: Accepted

Solution code:
import string

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

ans = ''
for i in range(len(s)):
  ans += string.ascii_uppercase[(string.ascii_uppercase.index(s[i]) + n)%26]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
L = len(S)
a = 'a'
for i in range(L):
    O = ord(S[i]) + N
    if O > 90:
        O = (O-90)+64
    else:
        pass
    ans = chr(O)
    a = a+ans

print(a[1:])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2
n = int(input())
S = list(input())
for i in range(len(S)):
    S[i] = alpha[alpha.index(S[i])+n]
print("".join(S))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
b = ""
ab = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(int(len(s))):
    for j in range(int(len(ab))):
        if (s[i] == ab[j]):
            if (int(j+n) > 25):
                b += ab[j+n-26]
                break
            else:
                b += ab[j+n]
                break

print(b)

Submission status: Accepted

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

ans = ''
for c in s:
    i = ord(c) - ord('A')
    i = (i + n) % 26
    ans += chr(i + ord('A'))
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
 
t=[]
for i in range(len(s)):
  num=ord(s[i])+n
  if num>90:
    num-=26
  t.append(chr(num))

print("".join(t))

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
result=''
for i in range(len(S)):
  tmp=ord(S[i])+N
  if tmp<=90:
    result+=chr(tmp)
  else:
    result+=chr(tmp%91+65)
print(result)

Submission status: Accepted

Solution code:
i=int(input());s=input()
for a in s:
  ind = ord(a)+(i%26)
  if ind > 90:
    ind -= 26 
  print(chr(ind), end='', sep='')

Submission status: Accepted

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

def rot(s):
    return chr((ord(s) - 65 + N) % 26 + 65)

print("".join([rot(s) for s in S]))

Submission status: Accepted

Solution code:
import string
n = int(input())
s = input()
alpha_table=string.ascii_uppercase
ans=[]
for c in s:
    idx=alpha_table.index(c)
    ans.append(alpha_table[(idx+n)%26])
    
print(''.join(ans))

Submission status: Accepted

Solution code:
import math
import re
import copy

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alpha_c = [""]*26
for i in range(26):
    a = (i + n) % 26
    alpha_c[i] = alpha[a]
word = ""
for i in range(len(s)):
    for j in range(26):
        if alpha[j]==s[i]:
            word += alpha_c[j]
print(word)

Submission status: Accepted

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

for i in S:
	if(ord(i)+N<=90):
		print(chr(ord(i)+N),end='')
	else:
		c = (N+ord(i))-90+64
		print(chr(c),end='')

print()

Submission status: Accepted

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

for c in S:
    T += chr(((ord(c)-ord('A')+N)%26)+ord('A'))

print(T)

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
ans = ''
for i in s:
    t = (int(ord(i) + n - 64)) % 26
    if t == 0:
        ans += 'Z'
    else:
        ans += chr(t + 64)
print(ans)