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:
# -*- coding: utf-8 -*-
"""
AtCoder A
"""

import sys, math, random
import numpy as np

# N = int(input())
# A = list(map(int,input().split())) # N row 1 column
# A = [int(input()) for _ in range(N)] # 1 row N column
# S = str(input()) # str(input()) == input() -> 'abc'
# S = list(input()) # abc -> ['a','b','c']
# S.replace('ABC','X') # "testABCABC" -> "testXX"
# S=numpp.assaray(S)=="#"
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LLS(): return [list(sys.stdin.readline().rstrip()) for _ in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()



def main():
    N=I()
    A=S()
    al="ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    out=""
    for a in A:
        x=al.find(a)
        x+=N
        while x>25:
            x-=26
        out+=al[x]

    print(out)




if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
a = []
for i in s:
    b = ord(i) + n
    if b > ord('Z'):
        b = b % ord('Z') -1 + ord('A')
    a.append(chr(b))

print(''.join(a))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
s_ = ['a']*len(s)

Zorder = ord('Z')
for i in range(len(s)):
    order = ord(s[i]) + n
    if order > Zorder:
        order -= 26
    s_[i] = chr(order)


print(*s_, sep='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = 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']
ans = []

for c in s:
    i = alpha.index(c)
    ans.append(alpha[(i+n)%26])

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alphabet = [
    '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'
]
result =''
for s in S:
    target = alphabet.index(s)
    #print(target)
    tmp = (target+N)%26
    result += alphabet[tmp]
print(result)

Submission status: Accepted

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


def f(c):
    r = ord(c) + n
    if 90 < r:
        r = r - (r // 90) * 26
    return chr(r)


r = ''

for i in s:
    r += f(i)

print(r)

Submission status: Accepted

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

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

ans = ""
for i, x in enumerate(s):
    for j, y in enumerate(a):
        if y == x:
            index = (j + n) % 26
            ans += a[index]

print(ans)

Submission status: Accepted

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

d = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

print(''.join([d[(d.index(i) + n) % 26] for i in s]))

Submission status: Accepted

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

def ceaser(s):
    ns=[]
    for word in s:
        ns.append(chr((ord(word) - ord('A') + N) % 26 + ord('A')))

    return "".join(ns)


ans = ceaser(s)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = list(map(str, input()))

alphabet = [
    "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)):
    x = alphabet.index(s[i])
    s[i] = alphabet[
        (x + n) % 26
    ]

print("".join(s))

Submission status: Accepted

Solution code:
Al = [chr(i) for i in range(65, 65+26)]
N = int(input())
S = list(input())
#print(S)

Al_ans = []
for i in S:
    n = Al.index(i) + N
    if n > 25:
        n = n - 26
    Al_ans.append(Al[n])
ans = "".join(Al_ans)

print(ans)

Submission status: Accepted

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

list = {'A':1, 'B':2, 'C':3, 'D':4, 'E':5, 'F':6, 'G':7, 'H':8, 'I':9,'J':10, 'K':11, 'L':12, 'M':13, 'N':14, 'O':15, 'P':16, 'Q':17, 'R':18, 'S':19, 'T':20, 'U':21, 'V':22, 'W':23, 'X':24, 'Y':25, 'Z':26}
list2 = ['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 s in S:
    index = list[s] + N-1
    if index > 25:
        index -= 26
    print(list2[index], end='')

Submission status: Accepted

Solution code:

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

ascii_uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

num_to_char = {}
for i, char in enumerate(ascii_uppercase):
    num_to_char[i] = char

char_to_num = {}
for i, char in enumerate(ascii_uppercase):
    char_to_num[char] = i

ans = []
for char in S:
    num = char_to_num[char]
    num = (num + N) % 26
    ans.append(num_to_char[num])

print(*ans, sep="")

Submission status: Accepted

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

for char in S:
  #print(ord(char))
  added = ord(char)+N
  if added > 90:
    added = 64+added%90
  print(chr(added),end="")

Submission status: Accepted

Solution code:
import string

n = int(input())
S = input()
alphabets = [s for s in string.ascii_uppercase]

ans = ''
for s in S:
    index = alphabets.index(s) + n
    if index >= 26: ans += alphabets[index - 26]
    else: ans += alphabets[index]

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
A_list = [chr(ord("A") + i) for i in range(26)]
ans = ""
for i in S:
  order = A_list.index(i)
  order += N
  order = order % 26
  ans +=A_list[order]
print(ans)

Submission status: Accepted

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

# $ python rot_n.py s rot
import sys

def rot_n(c, n):
    if 'a' <= c and c <= 'z':
        return chr((ord(c) - ord('a') + int(n)) % 26 + ord('a'))
    
    if 'A' <= c and c <= 'Z':
        return chr((ord(c) - ord('A') + int(n)) % 26 + ord('A'))
    
    return c

def rot(s, n):
    c = (rot_n(c, n) for c in s)
    print( ''.join(c))

rot(s, n)

Submission status: Accepted

Solution code:
number = int(input())
letters = input()
new = ""


for letter in letters:
    o = ord(letter)+number
    if o > 90:
        o = o - 90
        o = o + 64
        
        new += chr(o)
    else: new += chr(o)
print(new)

Submission status: Accepted

Solution code:


def solve():
    N = int(input())
    S = input()
    alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    alp = list(alp)
    ans = ''
    for s in S:
        i = (alp.index(s) + N) % 26
        ans += alp[i]
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

def _rot_n(c, n):
    if 'A' <=c and c <='Z':
        return chr((ord(c)-ord('A') + n) % 26 + ord('A'))
    return c

def rot_n(s, n):
    g = (_rot_n(c, n) for c in s)
    return ''.join(g)

s = rot_n(s, N)
print(s)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
mys = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

myans = ''

for s in S:
    #print(s, mys.find(s))
    myans += mys[(mys.find(s)+N)%26]

print(myans)

Submission status: Accepted

Solution code:
n = int(input())
a = input()
b = ''
for a_ in a:
    s = ord(a_)+n
    while s>ord('Z'):
        s = s-ord('Z')+ord('A')-1

    b+= chr(s)
print(b)

Submission status: Accepted

Solution code:
# B - ROT N
N = int(input())
S = str(input())
def caesar(s, n):
    ns = []
    for ch in s:
        # A - Z
        if ('A' <= ch and ch <= 'Z'):
            ns.append(chr((ord(ch) - ord('A') + n) % 26 + ord('A')))
        # no change for other characters
        else:
            ns.append(ch)
    return "".join(ns)

result = caesar(S, N)
print(result)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
def rotn(n, s):
    a = ord(s)+n
    if a>90:
        a = 65 + a-90-1
    return chr(a)
ans = ""
for s in S:
    ans += rotn(N, s)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = []
for i in range(len(s)):
    for j in range(len(alpha)):
        if s[i] == alpha[j]:
            ans.append(alpha[(j+n)%26])
print(''.join(map(str,ans)))

Submission status: Accepted

Solution code:
alpha = [chr(i) for i in range(65, 65+26)]
a_change = []
n = int(input())
s = input()
for i in range(len(s)):
    moji = s[i]
    ind_moji = alpha.index(moji)
    a_change.append(alpha[(ind_moji+n) % 26])
print("".join(a_change))

Submission status: Accepted

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

ans = ""
for v in S:
    c = ord(v) + N
    if c <= ord("Z"):
        ans += chr(c)
    else:
        ans += chr(c - ord("Z") + ord("A") - 1)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
al = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
dic1 = dict(zip(al,list(range(len(al)))))
tmp = []
for i in S:
    tmp.append((dic1[i]+N)%26)
dic2 = dict(zip(list(range(len(al))),al))
ans = []
for j in tmp:
    ans.append(dic2[j])
print(*ans,sep="")

Submission status: Accepted

Solution code:
shift = int(input())
a = list(map(lambda ch: ord(ch) - ord('A'), list(input())))
for i in range(len(a)):
    a[i] = chr((a[i] + shift) % 26 + ord('A'))
print(''.join(a))

Submission status: Accepted

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

w=["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"]

result=""
for i in range(len(S)):
    idx=w.index(S[i])
    new_idx=(idx+N)%len(w)
    result=result+w[new_idx]

print(result)

Submission status: Accepted

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

r = ''
A = ord('A')
Z = ord('Z')
for s in S:
    v = ord(s) + N

    if v - Z > 0:
        r += chr(A + v - Z - 1)
    else:
        r += chr(v)
        
print(r)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
a='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

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


print(ans)

Submission status: Accepted

Solution code:
#  --*-coding:utf-8-*--

def f(C, N):
    return chr((ord(C) + N - 65)%26 + 65)

def main():
    N = int(input())
    S = input()
    
    print(''.join([f(C, N) for C in S]))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

x = [chr(i) for i in range(65, 65+26)]*2

[print(x[x.index(i)+n],end="") for i in s]
print()

Submission status: Accepted

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

for i in range(len(s)):
	ans += a[a.index(s[i]) + n]

print(ans)

Submission status: Accepted

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

s = "abcdefghijklmnopqrstuvwxyz"

# print (ord(S[0]), ord('a'))
newS = "".join([chr((ord(a) - ord('A') + N) % 26 + ord('A')) for a in list(S)])

print (newS)

Submission status: Accepted

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

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

print(s)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
S = str(input())
AZ = [chr(i) for i in range(65, 65+26)]
M = ""

for i in S:
    for j in range(len(AZ)):
        if i == AZ[j]:
            i = AZ[(j+N) % 26]
            M += i
            break;

print(M)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
a=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
ans=""
for i in range(len(s)):
    for j in range(26):
        if s[i]==a[j]:
            ans+=a[(j+n)%26]
            break

print(ans)

Submission status: Accepted

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

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

print(''.join(s))

Submission status: Accepted

Solution code:
import string

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

ans = ""

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

print(ans)

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']
ans = []
l = len(t)
for s in S:
    i = t.index(s)
    i += N
    if l <= i:
        ans.append(t[i-l])
    else:
        ans.append(t[i])
print(''.join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
ls = ["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] == ls[j]:
            S[i] = ls[(j+N) % 26]
            break

print(*S, sep = "")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
dictionary = {}
dict_gyaku = {}
for i,a in enumerate(alpha):
    dictionary[a] = i
    dict_gyaku[i] = a
ans = ''
for j in s:
    ans += dict_gyaku[(dictionary[j] + n)%26]
    
print(ans)

Submission status: Accepted

Solution code:
words = lambda t : list(map(t, input().split()))
n = int(input())
s = input()

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

def conv(c,n):
    co = ord(c)
    co += n
    if co > 90:
        co -= 26
    #print(co)
    return chr(co)

ans = ""
for c in s:
    ans += conv(c,n)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy,copy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	n = INT()
	s = input()
	for x in s:
		p = ord(x) % 65
		q = (p + n) % 26
		print(chr(q + 65), end = '')

if  __name__=='__main__':
    main()

Submission status: Accepted

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

alf = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

slide = alf[N:] + alf[:N]

ans = []

for i in S:
    l = alf.index(i)
    t = slide[l]
    ans.append(t)

print("".join(ans))

Submission status: Accepted

Solution code:
from string import ascii_uppercase as ascii


def main(n: int, s: str):
    ans = ""
    for _s in s:
        ans += ascii[(ascii.index(_s) + n) % 26]

    print(ans)


if __name__ == "__main__":
    n = int(input())
    s = input()

    main(n, s)

Submission status: Accepted

Solution code:
def deencrypt(str, key):
    plaintext = ""

    for ch in list(str):
        if 'A' <= ch <= 'Z':
            plaintext += chr((ord(ch) - ord('A') + key) % 26 + ord('A'))
        elif 'a' <= ch <= 'z':
            plaintext += chr((ord(ch) - ord('a') + key) % 26 + ord('a'))
        else:
            plaintext += ch

    return plaintext


N = int(input())
ciphertext = input()

print(deencrypt(ciphertext, N))

Submission status: Accepted

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

ans = ''

for i in range(len(s)):
    s1 = s[i]
    count = ord(s1)
    count += n
    if count >= 91:
        count -= 26
    ans += chr(count)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
ans = []
characters = ['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 s in S:
    pos = characters.index(s)
    p = pos + N
    if p < 26:
        ans.append(characters[p])
    else:
        ans.append(characters[p-26])
        
print("".join(ans))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
S = input()

s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in range(len(S)):
    n = (s.index(S[i]) + N)
    if n >= 26:
        n -= 26
    ans += s[n]
    
print(ans)

Submission status: Accepted

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



if __name__ == "__main__":
    main()

Submission status: Accepted

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

al = ["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"]
news = ""
for i in range(len(s)):
    for j in range(len(al)):
        if s[i] == al[j]:
            news += al[(j+n)%26]

print(news)

Submission status: Accepted

Solution code:
N=int(input())

def addN(x):
  a=ord(x)+N
  if a > 90:
    a = a -90 + 65 -1
  return chr(a)
  
S=list(map(addN, list(input())))

print(''.join(S))

Submission status: Accepted

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

ans = ""

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

print(ans)

Submission status: Accepted

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

for i in range(len(S)):
    if ord(S[i])+N > ord("Z"):
        T.append(chr(ord(S[i])+N-26))
    else:
        T.append(chr(ord(S[i])+N))

print("".join(T))

Submission status: Accepted

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

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

Submission status: Accepted

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

alp = "abcdefghijklmnopqrstuvwxyz".upper()
alp *= 2
ans = ""
for i in s:
    ind = alp.index(i)
    ans += alp[ind+n]
print(ans)

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
S = list(input())
s = len(S)
for i in range(s):
    k = ord(S[i])-64 + N
    if k>26:
        k -= 26
    S[i] = chr(k+64)
print(''.join(S))

Submission status: Accepted

Solution code:
import string

N = int(input())
S = input()
tmp = [''] * len(S)

for i in range(len(S)):
    tmp[i] = string.ascii_uppercase.index(S[i])

ans = ''
for i in tmp:
    ans += string.ascii_uppercase[(i + N) % 26]
print(ans)

Submission status: Accepted

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

ans = []
for i in range(len(S)):
	t = ord(S[i])
	t += N
	if t > 90:
		t = 65+(t-91)
	ans.append(chr(t))

print("".join(ans))

Submission status: Accepted

Solution code:
n=int(input())
s=input()
ss=''
for c in s:
    cc=ord(c)+n
    if (cc > ord('Z')):
        cc-=26
    ss+=chr(cc)
print(ss)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = input()
    x = [chr(i) for i in range(65, 65+26)]
    ans = ''
    for si in S:
        ind = x.index(si)
        next_c = ind + N
        # print(next_c)
        if next_c >= 26:
            next_c -= 26
        ans += x[next_c]

    print(ans)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    S = input()
    logging.info("Hello!")

    answer = ""
    for c in S:
        num = ord(c) + N
        if num <= 90:
            answer += chr(num)
        else:
            num = num - 90 + 64
            answer += chr(num)

    print(answer)
            
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    N = II()
    S = input()
    for c in S:
        write(chr((ord(c)-ord('A')+N)%26+ord('A')))
    write('\n')





if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

result = ""
for s in S:
    index = chars.index(s)
    index = (index + N) % 26
    result += chars[index]

print(result)

Submission status: Accepted

Solution code:
rot = int(input())
s = input()
g = (chr((ord(c) - ord('A') + rot) % 26 + ord('A')) for c in s)
print("".join(g))

Submission status: Accepted

Solution code:
#import heapq
#import itertools
#import math
#import numpy as np
#import sys

N = int(input())
S = list(input())
#A,B = list(map(int, input().split()))
#S = [input() for _ in range(H)]
#T = [list(map(int,input().split())) for _ in range(N)]
#sys.exit()
ALPHA = [chr(ord('A') + i) for i in range(26)]

for i in range(len(S)):
    ind = ALPHA.index(S[i])
    if int(ind) + N > 25 :
        S[i] = ALPHA[int(ind) + N - 26]
    else :
        S[i] = ALPHA[int(ind) + N]
print(''.join(S))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

converted_list=[]
for s in list(S):
    index=mapping.index(s)
    converted_list.append(mapping[(index+N)%26])

print(''.join(converted_list))

Submission status: Accepted

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

SS = ""
for c in S:
    for i in range(26):
        if c == moji[i]:
            SS += moji[(i+N)%26]
            break
print(SS)

Submission status: Accepted

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

alphabets = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

out = ''
for c in s:
    idx = alphabets.index(c)
    out += alphabets[(idx + n) % 26]

print(out)

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
from string import ascii_uppercase 
table = ascii_uppercase + ascii_uppercase

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

ans = ''.join([table[table.index(s) + N] for s in S])

print(ans)

Submission status: Accepted

Solution code:
s=int(input())
r=input()
result=""
for a in r:
  if ord(a)+s>90:
    result=result+chr(ord(a)+s-26)
  else:
    result=result+chr(ord(a)+s)
print(result)

Submission status: Accepted

Solution code:
def rotate(N, S):
	words = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	m = len(words)
	ans = ""
	for s in S:
		idx = words.find(s)
		ans += words[(idx + N) % m]
	return ans


if __name__ == "__main__":
	N = int(input())
	S = input()
	print(rotate(N, S))

Submission status: Accepted

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

cha = ["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)):
    print(cha[(cha.index(S[i]) + N) % 26],end="")

Submission status: Accepted

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

a = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

for i in range(len(s)):
    for j in range(len(a)):
        if s[i] == a[j]:
            s[i] = a[(j + n) % 26]
            break
print(''.join(s))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
AL = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

print("".join(s))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alpha = [chr(i) for i in range(65,65+26)]
text = []
ans = []
for i in list(S):
    text.append(alpha.index(i))
for i in range(len(S)):
    text[i] = (text[i] + N) % 26
for i in range(len(S)):
    ans.append(alpha[text[i]])
print("".join(map(str,ans)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
s = list(input())
for i in range(len(s)):
    tmp = ord(s[i]) + n
    if tmp > 90:
        tmp -= 26
    s[i] = chr(tmp)

print(''.join(map(str, s)))

Submission status: Accepted

Solution code:
k=int(input())
msg=input()
for it in msg:
    print(chr(ord('A')+(ord(it)-ord('A')+k)%26),end="")
print()

Submission status: Accepted

Solution code:
n = int(input())
S = input()
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"]
s1 = ""
for s in S:
  sind = l.index(s)
  s1 += l[(sind+n)%26]
print(s1)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
res = ""
for _s in s:
    ind = string.find(_s)
    new_ind = ind + n if ind + n < 26 else (ind + n) % 26
    res += string[new_ind]
print(res)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
lst = ["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] = lst[(lst.index(S[i])+N)%26]
    
print("".join(S))

Submission status: Accepted

Solution code:
b=int(input())
a=input()
s=["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"]
aa=[]
i=0
for x in a:
    for y in s:
        if y==x:
            aa.append(s[i+b])
            break
        i+=1
    i=0
print(''.join(aa))

Submission status: Accepted

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

alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

ans = []

for s in S:
  for i,al in enumerate(alph):
    if s==al:
      ans.append(alph[(i+N)%len(alph)])
      break
ans = ''.join(ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = ''
for s in S:
    idx = ord(s)- ord("A")
    idx = (idx + N) % 26
    ans += chr(idx + ord("A"))

print(ans)

Submission status: Accepted

Solution code:
import string
a=string.ascii_uppercase
n=int(input())
s=input()
ans=""
for i in range(len(s)):
  ans+=a[(a.find(s[i]) + n) % len(a)]
print(ans)

Submission status: Accepted

Solution code:
N =int(input())
S = list(input())
ans = []
for val in S:
    c = ord(val) + N
    if c > 90:
        c -= 26
    ans.append(chr(c))
print("".join(ans))

Submission status: Accepted

Solution code:
import math
import queue
import bisect
import heapq
import time
import itertools

mod = 1e9+7

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def main():
    n = int(input())
    s = input()
    ans = []
    for i in range(len(s)):
        asc = ord(s[i])+n
        if asc>90:
            asc -= 26
        ans.append(chr(asc))
    print(''.join(ans))
    return


if __name__=='__main__':
    main()

Submission status: Accepted

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


for i in range(len(S)):
    for j in range(26):
        if S[i]==M[j] :
            print(M[j+N],end="")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template


def main():
    cap = [chr(i) for i in range(65, 65 + 26)]
    N = ii()
    S = li()
    T = ['' for i in range(len(S))]
    for i in range(len(S)):
        T[i] = cap[(ord(S[i]) + 13 + N) % 26]
    print(''.join(T))
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
n = n % 26
new_s = ""
for i in s:
    val = ord(i) + n
    if val > ord('Z'):
        val = ord('A') + (val - ord('Z')-1)
    new_s += chr(val)
print(new_s)

Submission status: Accepted

Solution code:
def read():
    N = int(input().strip())
    S = str(input().strip())
    return N, S

def rotN(N, S):
    T = []
    for s in S:
        c = ord(s) - ord('A')
        c = (c + N) % 26
        T.append(chr(c + ord('A')))
    return ''.join(T)

def solve(N, S):
    return rotN(N, S)

if __name__ == '__main__':
    inputs = read()
    output = solve(*inputs)
    print("%s" % output)

Submission status: Accepted

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

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
al = list(a)

Sl = list(S)

for i, s in enumerate(Sl):
    idx = al.index(s)
    idx2 = idx + N
    if idx2>=26:
        idx2 -= 26
    Sl[i] = al[idx2]
    
print("".join(Sl))

Submission status: Accepted

Solution code:
alpha = [chr(i) for i in range(65, 65+26)]
n = int(input())
S = [i for i in input()]

S_ = [alpha[(alpha.index(i) + n) % 26] for i in S]
print("".join(S_))

Submission status: Accepted

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

for i in range(len(s)):
  temp=(ord(s[i])+n)
  if temp>=91:
    temp-=26
  #print(temp)
  s[i]=chr(temp)

print("".join(s))