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)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#ABC146-B
n=ii()
s=list(ss())
for i in range(len(s)):
    p=ord(s[i])
    if p+n >=91:

        s[i]=chr(p+n-26)

    else:

        s[i]=chr(p+n)
print("".join(s))

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)
    elif ord(i)+n >90:
        ans +=chr(ord(i)+n-26)
print(ans)

Submission status: Accepted

Solution code:
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']
N = int(input())
S = list(input())
B = []
for i in range(len(S)):
  for j in range(26):
    if S[i] == A[j]:
      if j+N > 25:
        B.append(A[j+N-26])
      else:
        B.append(A[j+N])
print(''.join(B))

Submission status: Accepted

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


def solve(N: int, S: str):
    l = list(string.ascii_uppercase)
    ans = ''
    for s in S:
        ans += l[(l.index(s) + N) % 26]
    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = [chr(i) for i in range(65,65+26)]
n = int(input())
s = input()
ans = ""
for i in range(len(s)):
    x = (a.index(s[i])+n)%26
    ans += a[x]
print(ans)

Submission status: Accepted

Solution code:
import string
al = list(string.ascii_uppercase)
n = int(input())
s = input()
ans = ""
for ch in s:
  i = al.index(ch)
  if len(al) > (i+n): ans += al[i+n]
  else: ans += al[(i+n)-len(al)]
print(ans)

Submission status: Accepted

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

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

print("".join(T))

Submission status: Accepted

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

for i in range(0, len(s)):
  x = ord(s[i]) - ord('A')
  x = (x + n) % 26
  a.append(chr(x + ord('A')))
print(''.join(a))

Submission status: Accepted

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

al = list(string.ascii_uppercase)
ans = []
for i in S:
    pos = al.index(i) + N
    if pos < 26:
        ans.append(al[pos])
    else:
        ans.append(al[pos-26])
print(''.join(ans))

Submission status: Accepted

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

ABCtoNum = dict()
NumtoABC = dict()
for i, s in enumerate('ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
    ABCtoNum[s] = i
    NumtoABC[i] = s
ABC_N = dict()
for s, i in ABCtoNum.items():
    ABC_N[s] = NumtoABC[(i+N)%26]

ans = list()
for s in S:
    ans.append(ABC_N[s])
print(''.join(ans))

Submission status: Accepted

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

STRINGS = [chr(ord('A') + i) for i in range(26)]
res = ""
for s in S:
    idx =( STRINGS.index(s) + N) % 26
    res += STRINGS[idx]

print(res)

Submission status: Accepted

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

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

print(char)

Submission status: Accepted

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

words = [chr(i) for i in range(65, 65+26)]
words2 = [chr(i) for i in range(65, 65+26)] * 2
for i in range(len(S)):
    ind = words.index(S[i]) + N
    print(words2[ind],end="")

Submission status: Accepted

Solution code:
#146_B
n = int(input())
s = list(input())

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

Submission status: Accepted

Solution code:
def f(c):
    ret = ord(c)+n
    if ret > ord('Z'):
        ret -= ord('Z') - ord('A') + 1
    return chr(ret)

n = int(input())
s = input()
print(''.join(map(f, s)))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = input()
    res = ''
    for c in S:
        v = ord(c) + N
        if v > 90:
            v = v % 90 + 64
        res += chr(v)
    print(res)
    

main()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
for i in S:
  x = N + ord(i)
  if x > 90:
    x -= 26
  y = chr(x)
  print(y,end='')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
ans = ''
for i in s:
  o = ord(i) + n
  if i.islower():
    r = (o-97) % 26
    ans = ans + chr(97+r)
  elif i.isupper():
    r = (o-65) % 26
    ans = ans + chr(65+r)
print(ans)

Submission status: Accepted

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

lst = []
for i in S:
    x = ord(i)
    if x + N > 90:
        x = x - 90 - 1 + 65
    lst.append(chr(int(x) + N))
print(''.join(lst))

Submission status: Accepted

Solution code:
c = int(input())
S = input()
l = ""
for i in range(len(S)):
    m = ord(S[i])+c
    if m > 90:
        m -= 26
    l += chr(m)
print(l)

Submission status: Accepted

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

for i in range(len(s)):
    t = ord(s[i])
    t1 = t + n
    if t1 > 90:
        t1 = t1 - 26
    s_new.append(chr(t1))
print(*s_new,sep='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
strings = [chr(ord(c)+n) if ord(c)+n <= ord("Z") else chr(ord(c)+n-26) for c in s]
ans = "".join(strings)
print(ans)

Submission status: Accepted

Solution code:
n = input()
s = raw_input()
l = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
r = ""
for i in s:
    r += l[l.index(i)+n]
print r

Submission status: Accepted

Solution code:
# import bisect
# import heapq
# from copy import deepcopy
# from collections import deque
# from collections import Counter
# from itertools import accumulate
# from itertools import permutations
# import numpy as np
# import math
# mod = 10**9 + 7

# n = int(input())
# a = list(map(int, input().split()))
n = int(input())
s = input()
ans = []
for i in s:
    ans.append(chr((ord(i)-ord('A')+n)%26 + ord('A')))

print(''.join(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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

sa=""
for i in s:    
    if ord(i)+n > ord("Z"):
        sa+=chr(ord("A")-1+ord(i)+n - ord("Z"))
    else:
        sa+=chr(ord(i)+n)

print(sa)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
l = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
H =""
for i in S:
    a = (l.index(i) + N) % 26
    H += l[a]
print(H)

Submission status: Accepted

Solution code:
alplist = ["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()
ans = ""
for i in range(len(s)):
  for j in range(len(alplist)):
    if s[i] == alplist[j]:
      if j + n <= len(alplist)-1:
        ans += alplist[j+n]
      else:
        ans += alplist[j+n-len(alplist)]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

l = []
for x in s:
  if x in z:
    l.append(z[(z.index(x))+n])

print(''.join(l))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

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

def convert(s):
    if N + ord(s) <= ord('Z'):
        return chr(N + ord(s))
    else:
        return chr(ord('A') + ((N + ord(s)) - ord('Z') - 1))

print(''.join(list(map(convert, list(S)))))

Submission status: Accepted

Solution code:
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline())
    S = sys.stdin.buffer.readline().decode().rstrip()


    ret = []
    for s in S:
        n = (ord(s) + N - 65 ) % 26
        ret.append(chr(n+65))

    print("".join(ret), end="")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline())
    S = sys.stdin.buffer.readline().decode().rstrip()

    ret = []
    for s in S:
        n = ord(s) + N
        if n > 90:
            ret.append(chr(n - 26))
        else:
            ret.append(chr(n))

    print("".join(ret), end="")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ret = []
for s in S:
    n = ord(s) + N
    if n > 90:
        ret.append(chr(n - 26))
    else:
        ret.append(chr(n))

print("".join(ret), end="")

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alpha *= 2
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()
ans=""
for i in range(len(S)):
    index=ord(S[i])+N
    if index>=91:
        index=index-26
    ans=ans+chr(index)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
ans =""
for c in S:
    tmp=ord(c)+N
    if(tmp>90):
        tmp=tmp-90+64
    ans+=chr(tmp)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#整数の入力
N = int(input())
#文字列の入力
S = input()
#listを一文字ずつのlistに
S_list = list(S)

ans = ""
for i in range(len(S_list)):
  if(ord(S_list[i])+N<=90):
    #インクリンメント 次の文字を表示
    ans = ans + chr(ord(S_list[i]) + N)
  else:
    a = ord(S_list[i])+N - 90
    #print(a)
    ans = ans + chr(a+64)
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import string

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

l = string.ascii_uppercase
ans = [l[(l.index(s) + N) % len(l)] for s in S]

print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S=list(input())
A=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
for i in range(len(S)):
    S[i] = A[(A.index(S[i])+N)%26]
print(*S, sep="")

Submission status: Accepted

Solution code:
n=int(input())
s=input()
a=''
for c in s:
    t=ord(c)+n
    if t>90:
        t=t-90+64
    a+=chr(t)
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for c in s:
    ans += a[(a.find(c) + n) % 26]
print(ans)

Submission status: Accepted

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

ss = [0]*len(s)

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

print("".join(s))

Submission status: Accepted

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

a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
p = ''
for i in range(len(s)):
  x = a.find(s[i])
  x += n
  if x <= 25:
    p += a[x]
  else:
    p += a[x-26]
print(p)

Submission status: Accepted

Solution code:
shift = int(input())
X = input()
ans=''
#print(X)

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

#print(DIC)

for i in X:
    ans += LIST[(DIC[i] + shift) % 26]
    
print (ans)

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
change="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA"
change2=""
for i in range(26):
  change2+=change[i+n] 
for i in range(len(s)):
	s[i]=change2[change.find(s[i])]
print("".join(s))

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:

def main():
    num = int(input())
    str = input()

    array = []

    for i in range(len(str)):
        change_str = ord(str[i])
        over_num = change_str +  num
        if (over_num > 90):
            over_num = over_num - 90 + 64
        
        array.append(chr(over_num))
    
    str2 = ''.join(array)
    print(str2)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
S = [i for i in S]

for i in range(len(S)):
    for j in range(0, 26):
        if j+N<=25:
            if S[i]==chr(j+65):
                S[i]=chr(j+65+N)
                break
        else:
            if S[i]==chr(j+65):
                S[i]=chr(j+65+N-26)
                break

print(''.join(S))

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:
N = int(input())
S = input()
A = []
for i in range(len(S)):
    asc = ord(S[i])
    if(asc + N > 90):
        asc = asc+N-26
    else:
        asc += N
    A.append(chr(asc))

print("".join(A))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    S = input()
    ans = ''
    for i in S:
        if ord(i) + N > 90:
            ans += chr(ord(i) + N - 26)
        else:
            ans += chr(ord(i) + N)

    return ans

print(solve())

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    s = input()
    ans = []
    for i in range(len(s)):
        a = (((ord(s[i])-65) + n) % 26) + 65
        ans.append(chr(a))
    print("".join(ans))
resolve()

Submission status: Accepted

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

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

print(T)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ss = list(input())

    ans = ''
    for s in ss:
        ans_temp = ord(s) + n
        if ord('A') <= ans_temp <= ord('Z'):
            ans += chr(ans_temp)
        if ans_temp < ord("A"):
            ans += chr(ord('Z') - (ord("A") - ans_temp) - 1)
        if ans_temp > ord('Z'):
            ans += chr(ord("A") + (ans_temp - ord('Z')) - 1)

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 11 14:41:22 2020

@author: Kanaru Sato
"""

N = int(input())
s = list(input())

loop = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2)

for i in range(len(s)):
    s[i] = loop[loop.index(s[i])+N]

print("".join(s))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 10 21:49:13 2020

@author: Kanaru Sato
"""

N = int(input())
s = input()

dict = {'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': 0}
slist = []
[slist.append(s[i]) for i in range(0,len(s))]

for i in range(0, len(s)):
    n = dict[slist[i]]
    n = (n+N)%26
    slist[i] = [k for k in dict.keys() if dict[k]==n][0]

ans = ""
for i in range(0,len(slist)):
    ans = ans+slist[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def rot(s,n):
  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"]
  S = []
  for i in range (len(s)):
    S.append(s[i])
  for i in range (len(S)):
    for j in range (len(ALP)):
      if S[i] == ALP[j]:
        S[i] = ALP[(j+n)%26]
        break
  res = S[0]
  for i in range(1, len(S)):
    res+=S[i]
  return res
            
print(rot(S,N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

N = int(input())
S = input()
alphabets = ['A']
for i in range(25):
  alphabets.append(chr(ord(alphabets[-1]) + 1))
ans = ''
for s in S:
  ans += alphabets[(alphabets.index(s)+N)%26]

print(ans)

Submission status: Accepted

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

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

ans = ''


for i in range(len(s)):
    xxx = s[i]
    index = mozi_list.index(xxx)
    new_index = index + n
    if new_index >= 26:
        new_index -= 26
    
    ans += mozi_list[new_index]

print(ans)

Submission status: Accepted

Solution code:
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

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

def searchIndex(c):
    return alphabet.index(c)
  
s_rot_n = ''
for i in range(len(s)):
    index = (searchIndex(s[i]) + n) % 26
    s_rot_n += alphabet[index]
    
print(s_rot_n)

Submission status: Accepted

Solution code:
import string

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

a = list(string.ascii_uppercase)
a += a

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

print(ans)

Submission status: Accepted

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

print(a)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
B = []
for i in range(len(S)):
    if ord(S[i])+N<=ord('A')+25:
        B.append(chr(ord(S[i])+N))
    else:
        B.append(chr(ord(S[i])+N-26))
print(''.join(B))

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
s = len(S)
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(s):
  for j in range(26):
    if S[i] == alp[j]:
      S += alp[j+N]
print(S[s:len(S)])

Submission status: Accepted

Solution code:
mojiretu = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
output = ""
index = 0
N = int(input())
S = input()

for j in S:
  count = 0
  for i in mojiretu:
    if i == j:
      output = output + (mojiretu[count + N]) 
      break
    count = count + 1  
  index = index + 1

print(output)

Submission status: Accepted

Solution code:
t="ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2
n=int(input())
ans=""
for i in input():
  ans+=t[t.index(i)+n]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
letters = list(string.ascii_uppercase * 2)
N = int(input())
S = list(input())
ans = ""
for i in range(len(S)):
    ans += letters[letters.index(S[i]) + N]
print(ans)

Submission status: Accepted

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

N = N%26
S_new = []
for s in S:
    s_new = chr((ord(s)-ord('A')+N)%26+ord('A'))
    S_new.append(s_new)

result = ''.join(S_new)
print(result)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
c2i = lambda c: ord(c) - ord('A')
i2c = ['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, s in enumerate(S):
    index = c2i(s)
    index += N
    if index >= 26:
        index -= 26
    S[i] = i2c[index]

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()
ans = []
for c in S:
    ans.append(chr(ord("A")+((ord(c)-ord("A"))+N)%26))
print("".join(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=str(input())
ans=""
for i in range(len(s)):
    tmp= (ord(s[i])-65+n)%26+65
    ans+=chr(tmp)
print(ans)

Submission status: Accepted

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

alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = [alp[(alp.index(s) + N) % 26] for s in S]
print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
for s in S :
    i = ord(s) + N
    if i > 90 :
        i -= 26
    print(chr(i), end="")
print()

Submission status: Accepted

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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


def rot_encode(n):
    from string import ascii_lowercase as lc, ascii_uppercase as uc
    lookup = str.maketrans(lc + uc, lc[n:] + lc[:n] + uc[n:] + uc[:n])
    return lambda s: s.translate(lookup)


print(rot_encode(N)(S))

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
hako=str()
for i in S:
  ad=ord(i)
  newad=ad+N
  if newad>ord('Z'):
    newad=newad-ord('Z')+ord('A')-1
  hako+=chr(newad)
print (hako)

Submission status: Accepted

Solution code:
n = int(input())
res = []
s = input()
res = list(map(lambda a:chr(((ord(a) - ord('A') + n) % 26) + ord('A')),list(s)))
print("".join(res))

Submission status: Accepted

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

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

print(t)

Submission status: Accepted

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

Submission status: Accepted

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

    ans = ""
    for c in S:
        asc_c = ord(c) + N
        asc_A = ord("A")
        asc_Z = ord("Z")

        if asc_c > asc_Z:
            asc_c = asc_A + (asc_c % asc_Z) - 1
        
        ans += chr(asc_c)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

# ord: アスキーコードを取得
# ord('a') -> 97

# chr: アスキーコードから文字へ
# chr('12354') -> 'あ'

ss = str()

for i in s:
    t = chr(ord(i) + n)

    if ord(t) > ord('Z'):
        t = chr(ord(t) - ord('Z') + ord('A')-1)
    
    ss += t

print(ss)

Submission status: Accepted

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

ss=str()

for i in s:
    t = chr(ord(i) + n)
    
    if ord(t) > ord('Z'):
        t = chr(ord(t) - ord('Z') + ord('A')-1)
    
    ss += t

print(ss)

Submission status: Accepted

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

ss=str()

for i in s:
    t = chr(ord(i) + n)
    
    if ord(t) > ord('Z'):
        t = chr(ord(t) - ord('Z') + ord('A')-1)
    
    ss += t

print(ss)

Submission status: Accepted

Solution code:
#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

import sys
input = sys.stdin.readline

n = int(input())
s= input()
ans = ""
for i in range(len(s)-1):
    ss=ord(s[i])
    #print(ss)
    if 65<=ss<=90-n:
        ss+=n
        #print(ss)
    else:
        ss+=-26+n
        #print(ss)
    ans+=chr(ss)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = ''
for char in s:
    over_cnt = (ord(char) + n) - ord('Z')
    if(over_cnt > 0):
        ans += chr(((ord('A') - 1 )+ over_cnt))
    else:
        ans += chr(ord(char)+n)
    over_cnt = -1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

strlist = "abcdefghijklmnopqrstuvwxyz".upper()
charnum = len(strlist)

ans = ""
for i in s:
    num = strlist.index(i)
    indx = (num + n) % charnum
    anschar = strlist[indx]
    ans = ans+anschar

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

##アルファベットリスト
al=[chr(ord('A') + i) for i in range(26)]

out=[]
for i in range(len(S)):
    num = al.index(S[i])
    if num>=26-N:
        num=num-26
    out.append(al[num+N])

out=''.join(out)

print(out)

Submission status: Accepted

Solution code:
a =[chr(i) for i in range(65, 65+26)]
l=[]
N = int(input())
v = input()
for i in range(len(v)):
  if a.index(v[i])+N >= 26:
    l.append(a[a.index(v[i])+N-26])
  else:
    l.append(a[a.index(v[i])+N])
print(''.join(l))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = str(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']

outputString = ""
for count in range(len(S)):
    add = AL.index(S[count])
    if add +N > 25:
        outputString = outputString + AL[add-26+N]
    else:
        outputString = outputString + AL[add+N]
print(outputString)

Submission status: Accepted

Solution code:
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"]
N = int(input())
S = input()
o = ""
for s in S:
  o += a[(a.index(s)+N)%26]

print(o)

Submission status: Accepted

Solution code:
import sys
import math
#a,b= map(int,input().split())
#li= [int(x) for x in input().split()]
a=int(input())
S=input()
x=0
for i in S:
  x=ord(i)+a
  if x<91:
    print(chr(x),end="")
  else:
    print(chr(x-26),end="")