Problem:


Score : 200 points

Problem Statement

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

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

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

Constraints

0 \leq N \leq 26

1 \leq |S| \leq 10^4

S consists of uppercase English letters.

Input

Input is given from Standard Input in the following format:

N
S

Output

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

Sample Input 1

2
ABCXYZ

Sample Output 1

CDEZAB

Note that A follows Z.

Sample Input 2

0
ABCXYZ

Sample Output 2

ABCXYZ

Sample Input 3

13
ABCDEFGHIJKLMNOPQRSTUVWXYZ

Sample Output 3

NOPQRSTUVWXYZABCDEFGHIJKLM



Sample input:
2
ABCXYZ


Sample output:
CDEZAB

Submission status: Accepted

Solution code:
n=int(input());print("".join([chr((n+ord(x),n+ord(x)-26)[ord(x)>90-n])for x in input()]))

Submission status: Accepted

Solution code:
# B - ROT N
n = int(input())
s = input()
ans = ''
abc = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')*2
for i in range(len(s)):
    ans += abc[abc.index(s[i])+n]
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

n = I()
s = S()  # 65 - 90
ans = ""
for i in range(len(s)):
    tmp = ord(s[i]) + n
    if tmp > 90:
        ans += chr(tmp - 91 + 65)
    else:
        ans += chr(tmp)
print(ans)

Submission status: Accepted

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

ans = [chr(((((ord(s))+N)-65)%26)+65) for s in S]

print(*ans, sep="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B - ROT N

abc = [s for s in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']
N = int(input())
S = str(input())

def f(ch, n):
    if len(abc) - 1 < abc.index(ch) + n:
        return abc[(abc.index(ch) + n) - len(abc)]
    else:
        return abc[abc.index(ch) + n]

ans = ''
for s in S:
    ans += f(s, N)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

for s in S:
    temp = ord(s)+N
    if temp > ord('Z'):
        temp = ord('A') + temp - ord('Z') -1
    print(chr(temp), sep="", end="")
print()

Submission status: Accepted

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

Alphabet_List=list(string.ascii_uppercase)
Alphabet_List.extend(2*Alphabet_List)

for i in range(len(S)):
    for j in range(len(Alphabet_List)):
        if S[i]==Alphabet_List[j]:
            S[i]=Alphabet_List[j+N]
            break
            
print(("").join(S))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def minus26(idx):
    while idx >= 26:
        idx = idx - 26
    return idx
    
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']

S_idx = [alphabet.index(s)+N for s in S] 
S_idx = [minus26(idx) for idx in S_idx]
print(''.join([alphabet[idx] for idx in S_idx]))

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']
answer = []
for s in S:
    number = alphabet.index(s)
    while number + N >= 26:
        number = number - 26 
    answer.append(alphabet[number+N])
print(''.join(answer))

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']
answer = []
for s in S:
    number = alphabet.index(s)
    while number + N >= 25:
        number = number - 26 
    answer.append(alphabet[number+N])
print(''.join(answer))

Submission status: Accepted

Solution code:
n = int(input())
S = input()
s = list(S)
alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
al = list(alph)
for i in range(len(s)):
    s[i] = al[al.index(s[i])+n]
print(''.join(s))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
L='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=''
for i in range(len(S)):
  a=S[i]
  index=L.find(a)
  b=L[index+N]
  ans=ans+b
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in s:
  test.append(chr((ord(i) - 65 + n) % 26 + 65))

print(''.join(test))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    s=input()
    al = list(chr(ord('A') + i) for i in range(26))
    l=[]
    for j in s:
        l.append(al[(al.index(j)+n)%26])
    print(''.join(l))
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
lst_search = [chr(i) for i in range(65, 65+26)]
lst = [chr(i) for i in range(65, 65+26)] *2


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

print(ans)

Submission status: Accepted

Solution code:
A=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N=int(input())
S=list(input())
lenS=len(S)
for i in range(lenS):
    for j in range(len(A)):    
        if S[i]==A[j]:
            if j+N >=25:
                k=j-25+(N-1)
            else:
                k=j+N
    S[i]=A[k]
print(''.join(S))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
L = [chr(i) for i in range(ord("a"), ord("z") + 1)]

# print(L)
res = ""
for s in S:
    res += chr((ord(s) - ord("A") + N) % (ord("Z") - ord("A") + 1) + ord("A"))
    # print((ord(s) - ord("A") + N), (ord("Z") - ord("A")))
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
str=input()
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#a=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
for st in str:
  x=int(a.find(st))
  x+=n
  if x>=26:
     print(a[x-26],end="")
  else:
     print(a[x],end="")

Submission status: Accepted

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

for i in range(len(list)):
  list[i] = list[i].upper()

for i in range(len(s)):
  num = list.index(s[i])
  s[i] = list[num + n]
  moji = moji + s[i]
  
print(moji)

Submission status: Accepted

Solution code:

n=int(input())
s=list(input())
temp=['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]=temp[((temp.index(s[i]))+n)%26]
print(*s,sep='')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())
S=input()
output=""
L="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(len(S)):
    for j in range(len(L)):
        if S[i]==L[j]:
            output=output+L[(j+N)%len(L)]
print(output)

Submission status: Accepted

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

alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

ans =''
for i in range(len(S)):
    tmp_str=S[i]
    
    index = alphabet.find(tmp_str)

    rpl_str=alphabet[index+N]

    ans+=rpl_str

print(ans)

Submission status: Accepted

Solution code:
import string
n= int(input())
s= input()
a= string.ascii_uppercase
res = ''
for i in s:
    k=a.index(i)+n
    if k > 25:
        res += a[k-26]
    else:
        res += a[k]
print(res)

Submission status: Accepted

Solution code:
KEY = int(input())
PLAIN = input().lower()


enc = ""

for char in list(PLAIN):
    ASCII = ord(char)
    num = ASCII - 97
    num = (num + KEY) % 26
    ASCII = num + 97
    enc += chr(ASCII)

print(enc.upper())

Submission status: Accepted

Solution code:
import string
n = int(input())
s = input()
a = string.ascii_uppercase
res = ''
for i in s:
    k = a.index(i) + n
    if k > 25:
        res += a[k-26]
    else:
        res += a[k]
print(res)

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
alp = [chr(i) for i in range(65,65 +26)]
i = 0
l = []
while i < len(s):
  num = alp.index(s[i])
  l.append(alp[(num + n)%26])
  i += 1
print(''.join(l))

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
teb = alp[n:26]+alp[0:n]
ans = ''
for w in s:
    ans += teb[alp.index(w)]
print(ans)

Submission status: Accepted

Solution code:
n= int(input())
s = input()
a =''
b= 0
for i in range(len(s)):
    b = ord(s[i])  
    b += n
    if b >90:
        b =b-90+64
    a += chr(b)
    
print(a)

Submission status: Accepted

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

alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''

for i in range(len(s)):

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

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 accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
S = input()

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

print()

Submission status: Accepted

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

N = int(input())
S = input()
max_val = ord('Z')
N_mod = N % 26

ans = ''

for i in range(len(S)):
    a = ord(S[i]) + N_mod
    if a > max_val:
        a = a - 26

    ans += chr(a)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = list(str(input()))
alp = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#print(alp)

ans = []

for i in range(len(S)):
    #print(alp.index(S[i])+N-26)
    ans.append(alp[alp.index(S[i])+N-26])

print("".join(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
A = "abcdefghijklmnopqrstuvwxyz"
n = int(input())
N = input()
for i in range(len(N)):
  a = A.index(N[i].lower())
  a += n
  if a >= 26:
    a -= 26
  print(A[a].upper(),end="")
print("")

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
B = []
for a in S:
    b = ord(a) + N
    if ord(a) + N > 90:
        B.append(chr(b-26))
    else:
        B.append(chr(b))

for a in B:
    print(a, end="")

Submission status: Accepted

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

Submission status: Accepted

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

alphabet = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

for i in range(len(S)):
    index = alphabet.index(S[i])
    if index + N < 26:
        S[i] = alphabet[index+N]
    else:
        S[i] = alphabet[index+N-26]

S = "".join(S)
print(S)

Submission status: Accepted

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

Submission status: Accepted

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

S2=[]
for s in S1:
  c1=ord(s)-ord('A')
  c2=(c1+N)%26
  S2.append(chr(ord('A')+c2))
  
print("".join(S2))

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 = ""
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 os


def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

def main():
	n = int(input())
	s = input()
	result = ""
	for i in s:
		num = alpha2num(i)
		if num + n > 26:
			num = num + n - 26
		else:
			num += n
		string = num2alpha(num)
		result += string
	print(result)
	

if __name__ == "__main__":
	main()

Submission status: Accepted

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

for i in range(len(s)):
    if ord(s[i]) + n <= ord("Z"):
        string += chr(ord(s[i]) + n)
    else:
        string += chr(ord(s[i]) + n - 26)

print(string)

Submission status: Accepted

Solution code:

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

al=[chr(ord('A') + i) for i in range(26)]
al_n=al*2

lis=[]
for i in range(len(s)):
    ind=al.index(s[i])
    lis.append(al_n[ind+n])
print("".join(lis))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
ALL = [chr(i) for i in range(65, 65+26)]
M = len(ALL)
ans = []
for s in S:
    ans.append(ALL[(ALL.index(s) + N) % M])

print(''.join(ans))

Submission status: Accepted

Solution code:
n=int(input())
s=input()
ans=[]
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)):
    if list.index(s[i])+n <= 25:
        ans.append(list[list.index(s[i])+n])
    else:
        ans.append(list[list.index(s[i])+n-26])
print(*ans,sep='')

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

for i in s:
    num = ord(i) + n;
    #正規化
    num = num - ord("A")
    num = num % 26
    ans.append(chr(num  + ord("A")))
    
new = ""
for j in ans:
    new += j

print(new.upper())

Submission status: Accepted

Solution code:
import sys, math
from pprint import pprint
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
S = rs()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

k = 0
ans = ""

for i in S:
    j = ord(i) + N
    while j > 90:
        j -= 26
    ans += chr(j)

print(ans)

Submission status: Accepted

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

a = ''
for i in S:
    if ord('Z') < (ord(i) + N):
        a+=chr(ord('A') + ((ord(i) + N) - ord('Z') - 1))
    else:
        a+=chr(ord(i) + N)

print(a)

Submission status: Accepted

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

for i in S:
    print(al[(al.index(i)+N) % 26], end="")

Submission status: Accepted

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

def main():
    N, S = map(str, open(0).read().split())
    N = int(N)

    S_rep = []
    for i in range(0, len(S)):
        n = ord(list(S)[i])
        if (n + N < 91):
            S_rep.append(chr(n + N))
        else:
            S_rep.append(chr(n + N + 6))
    
    S_rep = ''.join(S_rep)
    print(S_rep.upper())



main()

Submission status: Accepted

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

Submission status: Accepted

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

def order(i, n):
    return chr(65 + (ord(i) - 65 + n) % 26)

for i in range(len(s)):
    s[i] = order(s[i], n)
print(''.join(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
import string
al = list(map(str, string.ascii_uppercase))
for j in range(n):
    al.append(al[j])
x = ""

li=list(input())
for i in range(len(li)):
    x += al[al.index(li[i]) + n]
print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
s=input()
l=len(s)
alp="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans=str()
for i in range(l):
	ans += alp[alp.index(s[i])+n]
print(ans)

Submission status: Accepted

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

for idx, alphabet in enumerate(S):
  code = ord(alphabet) + N
  if code > ord('Z'):
    code = ord('A') + (code - ord('Z') - 1)
  
  S[idx] = chr(code)

print(''.join(S))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#はっきり言ってあまり良い手とは言えないが思いつかなければ仕方ない。+N後の要素を参照させる。
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','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())
ls = list(input())
#アルファベットに対応する番号を取得
countlist = [None for _ in range(len(ls))]
for i in range(len(ls)):
  for j in range(26):
    if ls[i] == alphabet[j]:
      countlist[i] = j
#カウントリストに「N文字」分を加える
for i in range(len(countlist)):
  countlist[i] += N
#番号に対応するアルファベットを取得
anslist = [None for _ in range(len(ls))]
for i in range(len(anslist)):
  anslist[i] = alphabet[countlist[i]]
#結果。リスト内要素を結合して表示
ans = ''.join(anslist)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for c in chars:
    pos = alphabet.find(c)
    ans += alphabet[(pos + n) % 26]

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
L=[]
#print(int(ord(S[0]))+N)
for i in range(len(S)):
  if int(ord(S[i]))+N >= 91:
    ans=chr(int(ord(S[i]))+N-26)
  else:
    ans=chr(int(ord(S[i]))+N)
  L.append(ans)
print(''.join(L))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
alphabet = string.ascii_uppercase

n = int(input())
s = list(input())
for i in range(len(s)):
    pos = alphabet.index(s[i]) + n
    if pos > 25:
        pos -= 26
    s[i] = alphabet[pos]
print("".join(s))

Submission status: Accepted

Solution code:
a = int(input())
b = input()
def rot_n(s, n):
    answer = ''
    for letter in s:
        answer += chr(ord('A') + (ord(letter)-ord('A')+n) % 26)

    return answer
print(rot_n(b, a))

Submission status: Accepted

Solution code:
import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
txt = ''
for i in s:
  txt += t[t.index(i) + n]
print(txt)

Submission status: Accepted

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

for i in range(len(S)):
  if ord(S[i]) + N > ord("Z"):
    p+= chr(ord(S[i])+N-26)
  else:
    p += chr(ord(S[i])+N)
print(p)

Submission status: Accepted

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

for s in S:
  if N <= ord("Z") - ord(s):
    res += chr(ord(s) + N)
  else:
    res += chr(ord("A") + (N - 1 - (ord("Z") - ord(s))))
print("".join(res))

Submission status: Accepted

Solution code:
n = int(input())
moji = 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"]
lst = list(moji)
for i in range(len(lst)):
  num = alphabet.index(lst[i])
  if num + n >= 26:
    lst[i] = alphabet[num+n-26]
  else:
    lst[i] = alphabet[num+n]
ans = ""
for j in range(len(lst)):
  ans += lst[j]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
s=input()
alp='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=''
for i in range(len(s)):
    b=alp.find(s[i])+n
    ans+=alp[b]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for c in chars:
    pos = alphabet.find(c)
    ans += alphabet[(pos + n) % 26]

print(ans)

Submission status: Accepted

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

for i in range(0,len(S)):
    tem = ord(S[i]) + N
    if tem > 90:
        tem = (tem % 90) + 64
    S[i] = chr(tem)

print("".join(S))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
S = input()
moji = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = []
for s in S:
    for m in moji:
        if m == s:
            ans.append(moji[(moji.index(m) + n) % len(moji)])
ans = "".join(ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
Ans = []
for i in range(len(S)):
  if ord(S[i]) + N <= 90:
    Ans.append(chr(ord(S[i]) + N))
  else:
    Ans.append(chr(ord(S[i]) + N - 90 + 64))
print(''.join(Ans))

Submission status: Accepted

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

for j in range(len(s)):
    for i in range(26):
        if s[j]==l[i]:
           ans += l[i+n] 
        else:
            pass

print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:

n = int(input())
s = input()
ans = ""
num = 0

for i in range(len(s)):
    num = ord(s[i])+n
    if num > 90:
        num = (num % 90) + 64
    ans += chr(num)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
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']
ans = []
for i in range(len(s)):
  for j in range(26):
    if s[i] == l[j]:
      if 25-j > n:
        ans.append(l[j+n])
      else:
        x = (j+1+n)%26-1
        ans.append(l[x])
print(''.join(ans))

Submission status: Accepted

Solution code:
#%%code
def resolve():
    N=int(input())
    S=input()
    ans=""
    for i in S:
        t=(ord(i)+N)
        if t>=ord("["):
            t-=ord("Z")-ord("A")+1
            
        ans+=chr(t)
    print(ans)

#%%submit! 
resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

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

ans = ''
for x in s:
    i = ord(x) + n
    if i > ord('Z'): i -= (ord('Z') - ord('A') + 1)
    ans += chr(i)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print("".join(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
shift_num = int(input())
string = list(input())

for i, char in enumerate(string):
    current_ord = (ord(char)+shift_num-ord('A')) % 26
    new = chr(current_ord + ord('A'))
    string[i] = new
    
print(''.join(string))

Submission status: Accepted

Solution code:
def q2():
    """B - ROT N"""
    N = int(input())
    S = list(input())
    
    for s in S:
        tmp = ord(s) + N
        if tmp > ord('Z'):
            tmp -= ord('Z') - ord('A') + 1
            
        print(chr(tmp), end='')
        
    print('')


if __name__ == '__main__':
    q2()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = int(input())
s = input()
ans = []
for i in range(len(s)):
    for j in range(len(alp)):
        if s[i] == alp[j]:
            if j + n <= 25:
                ans.append(alp[j+n])
            else:
                ans.append(alp[j+n-26])
ans = "".join(ans)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
l = [chr(i) for i in range(65,91)]
ss=len(l)-1
ans=""
for si in s:
  i=l.index(si)
  if i+n>ss:
    ans+=l[abs(i+n-ss)-1]
  else:
    ans+=l[i+n]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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