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:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
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 LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N = II()
	S = sys.stdin.readline()
	ans = ''
	for i in range(len(S)-1):
		if ord(S[i])+N > 90:
			ans += chr((ord(S[i])+N)%91 + 65)
		else:
			ans += chr((ord(S[i])+N))
	print(ans)

main()

Submission status: Accepted

Solution code:
n = int(input())
f = lambda c : 'A' if c == 'Z' else chr(ord(c)+1)

for c in input():
  for _ in range(n):
    c = f(c)
  print(c, end='')
print()

Submission status: Accepted

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

alpha = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

for i in list(S):
    print(alpha[(alpha.index(i) + N) % len(alpha)], end='')
print()

Submission status: Accepted

Solution code:
import string
import numpy as np
N = int(input())
S = list(input())
A2Z = string.ascii_uppercase

str_index = np.full(len(S), 0)
mod_26 = np.full(len(S), 26)
#print(str_index)

for i in range(len(S)):
    str_index[i] = A2Z.index(S[i])
str_index = (str_index+N) % mod_26
#print(str_index)

tmp = ['']*len(S)
for i in range(len(S)):
    index = int(str_index[i])
    tmp[i] = A2Z[index]
answer = ''.join(tmp)
print(answer)

Submission status: Accepted

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

print("")

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
l=len(s)
ans=""
a=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
for i in s:
    idx=a.index(i)
    t_idx=(idx+n) % 26
    ans += a[t_idx]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
def f(x,n):
  return chr(ord(x)+n) if ord(x)+n <= ord('Z') else chr(ord(x)+n-26)
S=f(s[0],n)
for i in range(len(s)-1):
  S=S+f(s[i+1],n)
print(S)

Submission status: Accepted

Solution code:
n=int(input())
s=list(map(str,input()))
for i in range(len(s)):
    if ord(s[i])+n>=91:
        s[i]=chr(ord(s[i])+n-90+64)
    else:
        s[i]=chr(ord(s[i])+n)
print(''.join(s))

Submission status: Accepted

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

list = []
for i in range(len(s)):
  asc = ord(s[i])+n
  if asc > 90:
    asc = asc-26
  
  list.append(chr(asc))
  
print(''.join(list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
r=[]
for x in s:
    c=ord(x)+n
    if c>90:c=c-26
    r.append(chr(c))
print("".join(r))

Submission status: Accepted

Solution code:
n = int(input())

ans = []
for s in input():
    i = ord(s) + n
    if i > 90:
        i -= 26
    ans.append(chr(i))

print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = [ord(v) for v in input()]

ans = []
for i in s:
    i += n
    if i > 90:
        i -= 26
    ans.append(chr(i))

print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = [ord(v) for v in input()]

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

print(ans)

Submission status: Accepted

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

ans = []

for i in range(len(s)):
  temp = ord(s[i]) + n
  if temp >= 91:
    temp = temp - 91 + 65
  ans.append(chr(temp))

print(''.join(ans))

Submission status: Accepted

Solution code:
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"]

N = int(input())

line = list(input())

for i in range(len(line)):
    line[i] = Alpha[(Alpha.index(line[i]) + N) % 26]
    
print("".join(line))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
L=input()[:-1]
F=[]
for i in range(len(L)):
    A=ord(L[i])+n
    if A>=91:
        A=A-91+65
    F.append(chr(A))
print("".join(F))

Submission status: Accepted

Solution code:
n=int(input())
L=input()
F=[]
for i in range(len(L)):
    A=ord(L[i])+n
    if A>=91:
        A=A-91+65
    F.append(chr(A))
print("".join(F))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
f=lambda x:chr(ord("A")+(ord(x)-ord("A")+N)%26)
print("".join(map(f, S)))

Submission status: Accepted

Solution code:
num = int(input())
text = input()
movedText = ""
for i in text:
  if ord(i) + num > ord("z") or ord(i) + num > ord("Z"):
    movedText += chr(ord(i) - 26 + num)
    continue
  movedText += chr(ord(i) + num)
print(movedText)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
list1 = ['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']
dic = {}
for i in range(26):
  dic[list1[i]] = (i + N) % 26

c = ''
for s in S:
  af_s = list1[dic[s]]
  c += af_s

print(c)

Submission status: Accepted

Solution code:
al_list = [chr(ord('A') + i) for i in range(26)]

n = int(input())
s = input()
r = ""
for i in range(len(s)):
    r += al_list[(al_list.index(s[i]) + n) % 26]

print(r)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    s = input().strip()
    
    for c in s:
        i = ord(c) + N
        # print(ord(c), i)
        if i > ord("Z"):
            i -= ord("Z") - ord("A") + 1
        print(chr(i), end="")
    print()

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
a = ""
b = []

List = ["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)):
    a = S[i]
    c = List.index(a)
    c = c + N
    if 25 < c:
        c = c - 26
    b.append(List[c])

for i in range(len(b)):
    print(b[i], end ='')

Submission status: Accepted

Solution code:
N, S = int(input()), input()
fun = lambda n, c: chr(((ord(c)-ord('A')+n)%(ord('Z')-ord('A')+1))+ord('A'))
print(''.join([fun(N, c) for c in list(S)]))

Submission status: Accepted

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

#大文字65
#chr(65) = "A"
#chr(90) = "Z"
T=""
for i in range(len(S)):
    a = ord(S[i])
    if (a+N) > 90:
        b = a+N - 90
        b = b % 26
        if b==0:
            s = "Z"
        else:
            c = 64+b
            s = chr(c)
        T = T + s
    else:
        a = a+N
        s = chr(a)
        T = T + s
print(T)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i,s in enumerate(S):
    S[i] = alpha[(alpha.index(s) + N) % 26]
print("".join(S))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
row = sys.stdin.readline


def read_int(row):
    return int(row().rstrip())

def read_string(row):
    return row().rstrip()

N = read_int(row)
S = read_string(row)

print("".join([chr((ord(i) + N - 26 if ord(i) + N > 90 else ord(i) + N)) for i in S]))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
newS = ''
for char in S:
    if ord(char)+N >= 91:
        newS += chr(ord(char)-26 + N)
    else:
        newS += chr(ord(char)+N)
print(newS)

Submission status: Accepted

Solution code:
import string

def main():
    n_a = dict(enumerate(string.ascii_uppercase))
    a_n = {v:k for k,v in n_a.items()}

    n = int(input())
    s = "".join(n_a[(a_n[c]+n)%26] for c in input())

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

Submission status: Accepted

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

a = ''
for i in range(lenlen):
    c = ord(s[i]) + n
    if 91 <= c:
        c = c - 26
    a = a + chr(c)
print(a)

Submission status: Accepted

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

result=""

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
l = len(s)
for i in range(l):
    a = ord(s[i]) + n
    if a > 90:
        a = a - 26
    s[i] = chr(a)

m = ''.join(s)
print(m)

Submission status: Accepted

Solution code:
n=int(input())
s = list(input())
for l in s:
  m = ((ord(l)-65)+n)%26+65
  j = chr(m)
  print(j,end="",sep="")

Submission status: Accepted

Solution code:
#146 b
n=int(input())
s=input()
ans=""
for x in s:
    num=(ord(x)+n)
    if num>90:
        num=64+num%90
    ans+=chr(num)
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:
N = int(input())
S = input()

list_str = ['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 s in S:
  _ = list_str.index(s)
  next_index = _ + N
  if next_index >= 26:
    next_index =  next_index - 26
  ans += list_str[next_index]

print(ans)

Submission status: Accepted

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

for i in s:
  if ord(i) + n > 90:
    print(chr(ord(i) + n - 91 + 65), end='')
  else:
    print(chr(ord(i) + n), end='')

Submission status: Accepted

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

MOD = 10 ** 9 + 7

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

strs = ['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 s in S:
    ans.append(strs[(strs.index(s)+N) % 26])

print(''.join(ans))

Submission status: Accepted

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

n = int(input())
s = input()
ans = []

for i in range(len(s)):
    ans.append(chr((ord(s[i])+n-ord('A'))%26 + ord('A')))
print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans =""
for i in range(len(S)):
    for j in range(len(alp)):
        if S[i] == alp[j]:
            if j+N >= 26:
                ans += alp[j+N-26]
            else:
                ans += alp[j+N]
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

res =""

offset = ord("A")
for ch in s:
    if ord(ch) + n >= offset + 26:
        res += chr((ord(ch) + n) - 26)
    else:
        res += chr((ord(ch) + n))
print(res)

Submission status: Accepted

Solution code:

n = int(input())
s = input()
A = ord("A")
B = ord("Z")
l = []
#print(ord("["))
#print(ord("A"))
#print(ord("Z"))

for i in range(len(s)):
    if ord(s[i])+n <= B:
        l.append(chr(ord(s[i])+n))
    else:
        l.append(chr(ord(s[i])+n-26))

print("".join(l))

#ord() 文字列を数値化
#chr()　数値化した文字を再度文字化

Submission status: Accepted

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

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']

ss = ""
for i in range(len(S)):
    s = S[i]
    num = l.index(s)
    ss += l[(num + N) % len(l)]

print(str.upper(ss))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for si in s:
    index = alphabet.find(si)
    print(alphabet[(index + n) % 26], sep='', end='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
AL =[chr(i) for i in range(65, 65+26)]
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 s in S:
    if ord(s)+N>90:
        ans+=chr(ord(s)+N-26)
    else:
        ans+=chr(ord(s)+N)
print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop
import itertools


#read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 7)

N = int(input())
A = list(input())


for i in range(len(A)):
    a = ord(A[i])
    a += N
    #print(a)
    while(a > 90):
        a -= 26

    A[i] = chr(a)

print(''.join(A))

Submission status: Accepted

Solution code:
N = int(input())
S = list(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"]
new_S = []
for i in range(len(S)):
  s = alphabet.index(S[i])+N
  if s >= 26 :
    s -= 26
  new_S.append(alphabet[s])
print("".join(new_S))

Submission status: Accepted

Solution code:
n=int(input())
s=input()
alf="ABCDEFGHIJKLMNOPQRSTUVWXYZ "
li=[]
for i in range(len(s)):
  li.append(alf[(alf.index(s[i])+n)%26])
for i in range(len(li)):
  print(li[i], end="")

Submission status: Accepted

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

alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for i in range(len(S)):
    idx = alpha.index(S[i])
    ans += alpha[(idx + N) % 26]
print(ans)

Submission status: Accepted

Solution code:
alph = ['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 = input()

new = ""
for s in S:
    idx = alph.index(s)
    new += alph[N - (len(alph) - idx)]
print(new)

Submission status: Accepted

Solution code:
import string

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

alpha = string.ascii_uppercase
ans = ""

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

print(ans)

Submission status: Accepted

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

ANS = ""

for MOJI in S:
  i = ord(MOJI) + N
  if i > 90:
    i = i - 26
  ANS = ANS + chr(i)

print(ANS)

Submission status: Accepted

Solution code:
# B - ROT N

D = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
n = int(input())
S = list(input())

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

print("".join(S))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
st=""
for i in range(len(S)):
   #print((ord(S[i])-65+N)%26)
   st="".join((st,chr((ord(S[i])-65+N)%26+65)))
print(st)

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(64 + n + ord(s[i]) - 90)
    else:
        ans += chr(ord(s[i]) + n)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
S = list(input())
for s in S:
  code = int(ord(s)) + n
  if code > 90:
    code += -90 + 64
  print(chr(code), end="")

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']
ans = []
for i in range(len(S)):
    B = A.index(S[i])
    ans.append(A[B+N])
print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
res = ''
for let in s:
    if ord(let) + n <= 90:
        newS = chr(ord(let)+n)
        res += newS
    elif ord(let) + n > 90:
        newS = chr((ord(let) + n) - 26)
        res += newS
print(res)

Submission status: Accepted

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

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

res = ""

for c in s:
    num = 0
    for i in range(0,len(mp)):
        if mp[i] == c:
            num = i
            break
    res += mp[(num + n) % 26]
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string

alp = string.ascii_uppercase
n = int(input())
word = list(input())
output = ""

for i in range(len(word)):
    idx = alp.index(word[i])
    output += alp[(idx + n) % 26]

print(output)

Submission status: Accepted

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

Submission status: Accepted

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

for ss in s:
    i = ord(ss)
    i += n
    if i>90:
        i -= 26
    ss = chr(i)
    print(ss, end='')

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
T=list(map(ord,S))
U=list(map(lambda x:x+N if x+N<=90 else x+N-26,T))
V=list(map(chr,U))
print(''.join(V))

Submission status: Accepted

Solution code:
# B 
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
s=si()
ans=''
for ss in s:
    ans+=chr((ord(ss)+n-65)%26+65)
print(ans)

Submission status: Accepted

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

for i in range(len(sList)):
  tmp = ord(sList[i])+n
  if tmp > ord('Z'):
    sList[i]= chr(ord('A')+(tmp-ord('Z')-1))
  else:
    sList[i]= chr(tmp)

print(''.join(sList))

Submission status: Accepted

Solution code:
# the uppercase letters are encoded as 65 to 90
# I want to put A as 0, so Z is 25

def letter_to_int(letter):
    return ord(letter)-65


def int_to_letter(encoded_value):
    return chr(encoded_value+65)


def shift_string(N, string):
    shifted_string = ""
    for char in string:
        encoding = letter_to_int(char)
        # mod ensures it wraps around, eg N=3 sends Z to C
        shifted = (encoding+N)%26
        decoded_to_letter = int_to_letter(shifted)
        shifted_string = shifted_string + decoded_to_letter
    return shifted_string


if __name__ == "__main__":
    test1 = \
"""2
ABCXYZ"""
    test2 = \
"""0
ABCXYZ"""
    test3 = \
"""13
ABCDEFGHIJKLMNOPQRSTUVWXYZ"""
    various_tests = [test1, test2, test3]
    """for test in various_tests:
        lines = test.split("\n")
        N = int(lines[0])
        string = lines[1]
        print(shift_string(N, string))"""
    N = int(input())
    string = input()
    print(shift_string(N, string))

Submission status: Accepted

Solution code:
n=int(input())
s=input()
y=[ord(i)+n for i in s]
for i in y:
    if i>=91:
        i%=91
        print(chr(i+65),end="")
    else:
        print(chr(i),end="")

Submission status: Accepted

Solution code:
N=int(input())
S=input()
V=[]
for i in range(len(S)):
  if ord(S[i])+N>90:
    V.append(chr(int(ord(S[i]))+N-26))
  else:
    V.append(chr(int(ord(S[i]))+N))
print("".join(map(str,V)))

Submission status: Accepted

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

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']
for i,w in zip(range(len(s)),s):
    idx=al.index(w)+n
    if idx>25:
        idx-=26
    if i==0:
        word=al[idx]
    else:
        word+=al[idx]    
print(word)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
result = ''
for s in S:
  if(ord(s) + N > ord('Z')):
    x = chr( (ord(s) + N) - 26)
  else:
    x = chr(ord(s) + N)
  result+=x
print(result)

Submission status: Accepted

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

res = []

for i in range(len(s)):
    chanum = ord(s[i]) + n
    if chanum > 90:
        num = chanum - 26
    else:
        num = chanum
    res.append(chr(num))

print("".join(res))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
print("".join([(chr(i+n) if i+n < 91 else chr(i+n-26)) for i in map(ord, list(input()))]))

Submission status: Accepted

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

def convert(letter, N):
    a = ord(letter) + N
    if a > 90: a = a - 26
    return chr(a)

# A -> 65, Z -> 90
ans = ""
for letter in S:
    ans = ans + convert(letter,N)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
t=''
for u in s:
  t+=chr((ord(u)-65+n)%26+65)
print(t)

Submission status: Accepted

Solution code:

def ABC146B():
    N = int(input())
    S = input()
    newstr = []
    for s in S:
        newstr.append(chr(((ord(s) + N) - ord('A')) % 26 + 65))

    print(''.join(newstr))

ABC146B()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
new_S = ''
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

for s in range (len(S)):
    for i in range(26):
        if (S[s] == alphabet[i]):
            new_S += alphabet[i+N]
            break
print(new_S)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
res = ""
for s in list(S):
    ch_num = ord(s) + N
    if ch_num > 90:
        ch_num -= 26
    res += chr(ch_num)
print(res)

Submission status: Accepted

Solution code:
def conv(c, n):
    p = ord(c) + n
    if p > ord("Z"):
        p -= (ord("Z") - ord("A") + 1)
    return chr(p)


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

print("".join(conv(c, N) for c in S))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
x = ""
for i in s:
    if ord(i) + n >= 91:
        x += chr(65 + ord(i) + n - 91)
    else:
        x += chr(ord(i) + n)
print(x)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
Alphabet = [chr(i) for i in range(65, 65+26)]
ans = ''
for i in range(len(S)):
  index = Alphabet.index(S[i])+N
  if index > 25:
    index -= 26
  ans += Alphabet[index]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
result = ""
for i in s:
  slide = n
  if ord(i) + slide > ord("Z"):
    slide = slide - 26
  result += chr(ord(i) + slide)
  
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

l = list(input().strip())

for c in l:
  tmp = ord(c) + n
  if tmp <= ord('Z'):
    print(chr(tmp),end="")
  else:
    print(chr(tmp%ord('Z') + ord('A')-1),end="")

Submission status: Accepted

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

print(''.join(list(map(lambda x:chr((ord(x)-ord('A')+N) % 26 + ord('A')),S))))

Submission status: Accepted

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

Z = ord('Z')
ans = ''

for c in s:
  d = ord(c) + n
  ans += chr(d - 26 if d > Z else d)

print(ans)

Submission status: Accepted

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

ans = ''

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

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
a=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
res=''

for s in S:
  code=a.index(s)+N
  if code>a.index('Z'):
    code-=26
  res+=a[code]
print(res)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
ans = []
for i in range(len(S)):
    if (ord(S[i])+N) > 90:
        ans.append(chr(ord(S[i])+N-90+64))
    else:
        ans.append(chr(ord(S[i])+N))
print(*ans,sep='')

Submission status: Accepted

Solution code:
N = int(input())
S = input()
H = [""] * len(S)

for i in range(len(S)):
  work = ord(S[i]) + N # a = 97
  if work > ord('Z') : # z = 122
    work -= 26

  H[i] = chr(work)
  
print("".join(H))

Submission status: Accepted

Solution code:
import math
import calendar
import fractions
import itertools

n = int(input())
s = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in s:
    if i == "z":
        ans += "A"
    i_index = alpha.index(i)
    ans_char_index = 100
    if i_index + n <= len(alpha) - 1:
        ans_char_index = i_index + n
    else:
        ans_char_index = (n - (len(alpha) - 1 - i_index)) % 26 - 1
    ans += alpha[ans_char_index]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
# #与えられた文字列 text を k回先にずらす関数。
def caesar(text, k):
    result = ""
    for i in range(len(text)):
        c1 = text[i]
        n1 = ord(c1)
        if 65 <= n1 <= 90:
            n2 = n1 + k
            if n2 < 65 or 90 < n2:
                n2 = 65 + (n2 - 65) % 26
            result = result + chr(n2)
        else:
            result = result + chr(n1)
    return result

ss = caesar(s, n)
print(ss)

Submission status: Accepted

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

ref = [chr(i) for i in range(65, 65+26)]

c = [ref.index(x)+n for x in s]
t = [ref[i] if i < 26 else ref[i-26] for i in c]
print(''.join(t))

Submission status: Accepted

Solution code:
N=int(input())
S=str(input())
sen=''
for i in range(len(S)):
    if ord(S[i])+N>90:
        sen+=chr(ord(S[i])+N-26)
    else:
        sen+=chr(ord(S[i])+N)
print(sen)

Submission status: Accepted

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

ans=''

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = list(map(ord, (str(input()))))
 
 
def Plus(x):
    x += N
    while(x>=91):
        x=64+(x%90)
    return x
 
print(''.join(list(map(chr, (list(map(Plus, S)))))))

Submission status: Accepted

Solution code:
def _rot(N):
    def rot(c):
        return chr(((ord(c) - ord('A') + N) % 26) + ord('A'))
    return rot

rot = _rot(int(input()))
print(''.join(map(rot, input())))

Submission status: Accepted

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

stack = ""
mi = ord('A')
mx = ord('Z')

for i in S :
    if ord(i)+N <= mx:
        stack = stack + chr(ord(i)+N)
    else:
        mem = ord(i)+N
        while mem > mx:
            mem = mem-26
        stack = stack + chr(mem)

print(stack)

Submission status: Accepted

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

Submission status: Accepted

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

mi = ord('A')
ma = ord('Z')

res = ''
for s in S:
    code = ord(s) + N
    if code > ma:
        code -= (ma - mi + 1)
    res += chr(code)

print(res)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
S = stdin.readline().rstrip()

output = ""
for s in list(S):
    output += chr((ord(s) + N - 65) % 26 + 65)
print(output)

Submission status: Accepted

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

    slist = list(S)
    result = slist

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

    print(''.join(result))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

    for s in S:
        if (ord(s)+N) > ord("Z"):
            print(chr(ord(s)-26+N), end="")
        else:
            print(chr(ord(s)+N), end="")
    return 0
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#python3
n=int(input())
print(''.join([chr((ord(i)-65+n)%26+65) for i in input()]))

Submission status: Accepted

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

print("".join([chr((((ord(x) + n) - ord("A")) % 26) + ord("A")) for x in s]))

Submission status: Accepted

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

Submission status: Accepted

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

a=ord('A')

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

Submission status: Accepted

Solution code:
def solve(N, S):
    alp = [chr(i) for i in range(65, 65+26)]
    new_text = ''

    for i in range(len(S)):
        new_char_i = alp.index(S[i]) + N

        if new_char_i >= len(alp):
            new_char_i -= len(alp)

        new_text += alp[new_char_i]

    return new_text


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

print(solve(N, S))

Submission status: Accepted

Solution code:
def charachange(ch, n):
    point =(ord(ch))
    point = point + n
    if point > 90:
        point = 64 + (point - 90)
    return chr(point)

N = int(input())
S = input()
result = ""
for i in range(len(S)):
    result += charachange(S[i], N)

print(result)

Submission status: Accepted

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

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