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:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

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

c = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

ans = []
for i in range(len(S)):
    n_c = c[((c.index(S[i]))+ N)% 26]
    ans.append(n_c)

print("".join(ans))

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  S = input()
  a = 0
  ans = ''
  
  for i in S:
    a = ord(i) + N 
    
    if (ord(i) + N) - ord('Z') > 0:
      a = (ord(i) + N) - 26
      
    ans += chr(a)
      
  print(ans)

  
  
main()

Submission status: Accepted

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

indices = list(map(ord, S))
indices2 = []
for idx in indices:
  if idx + N > 90: indices2.append(idx - 26 + N)
  else: indices2.append(idx + N)

S2 = list(map(chr,indices2))
print(''.join(S2))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
print(bytes((s-65+N)%26+65 for s in S.encode()).decode())

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()
I = ord("A")
T = ""
for s in S:
  T += chr((ord(s)-I+N)%26+I)
print(T)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans = ''
for s in list(S):
    ans += chr((ord(s) + N) % 91 + (65 if (ord(s) + N) % 91 < 65 else 0))
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
S=input()
print(*[chr((ord(c)-65+N)%26+65) for c in S],sep='')

Submission status: Accepted

Solution code:
N=int(input())
S=input()
print(*[chr(ord(c)+N-(ord(c)+N-65)//26*26) for c in S],sep='')

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
s = s()

alf = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(s)):
	for j in range(26):
		if s[i] == alf[j]:
			print(alf[j+n],end="")
			continue

Submission status: Accepted

Solution code:
n = int(input())
s = input()
A = ''
for i in s:
    A += chr(ord(i) + n if ord(i) + n <= 90 else ord(i) + n - 26)
print(A)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
out = ""
for i in s:
    if ord(i) + n > 90:
        out += chr(64+n-(90-ord(i)))
    else:    
        out += chr(ord(i)+n)

print(out)

Submission status: Accepted

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

for i in l:
    m = ord(i)
    if m + n <= 90:
        i = chr(m + n)
        L += i
    if m + n > 90:
        i = chr(m+n -26)
        L += i

print(''.join(L))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = str(input())
    ans = ''
    alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
    for i in range(len(S)):
        c = alphabet.index(S[i]) + N
        if c > 25:
            c = c - 26
        ans = ans + alphabet[c]
    print(ans)
main()

Submission status: Accepted

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

print(''.join(x))

Submission status: Accepted

Solution code:
n = int(input())
for i in input():
    if ord(i)+n>90: print(chr(64+ord(i)+n-90), end = '')
    else: print(chr(ord(i)+n), end = '')

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
S=input()
tmp=""
for i in range(len(S)):
  chtmp=ord(S[i])+N
  if(chtmp>ord('Z')):
    chtmp-=(ord('Z') - ord('A') + 1)
  tmp+=chr(chtmp)
print(tmp)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

for i in range(len(S)):
    if ord(S[i])+N <= 90:
        T.append(chr(ord(S[i])+N))
    elif ord(S[i])+N >90:
        T.append(chr(ord(S[i])+N-26))
    
for i in range(len(S)):
    print(T[i], end ='')

Submission status: Accepted

Solution code:
alp=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
n=int(input())
inp=input()
out=""
for i in inp:
  out+=alp[(alp.index(i)+n)%len(alp)]
print(out)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

ans = ''
for c in s:
    nc_ord = ord(c) + n
    while nc_ord > ord('Z'):
        nc_ord -= 26
    ans += chr(nc_ord)
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]) - ord('A') + N) % 26 + ord('A'))
print(''.join(S))

Submission status: Accepted

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

m = map(
  lambda x: chr((ord(x) - ord('A') + n) % 26 + ord('A')), list(s))
print(''.join(list(m)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import partial

N = int(input())
S = input()
lst = [chr(ord("A")+i) for i in range(26)]

def convert(x,n,l):
  id = ord(x) - ord("A")
  return l[(id+n)%26]

ans = "".join(map(partial(convert,n=N,l=lst),S))
print(ans)

Submission status: Accepted

Solution code:
from functools import partial

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

lst = [chr(ord("A")+i) for i in range(26)]

def convert(x,n):
  id = ord(x) - ord("A")
  return lst[(id+n)%26]

convert1 = partial(convert,n=N)

ans = "".join(map(convert1,S))
print(ans)

Submission status: Accepted

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

output = ""
for s in S:
  trans_s = chr((ord(s) - ord("A") + N) % 26 + ord("A"))
  output += trans_s

print(output)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
s = input()
a = [chr(i) for i in range(65, 65+26)]
ls = []
for x in a:
  ls.append(x)
for x in a:
  ls.append(x)
ans = []
for x in s:
  ans.append(ls[ls.index(x)+N])
print(''.join(ans))

Submission status: Accepted

Solution code:
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = readline().decode().rstrip()
ans = ''
A = ord('A')
for i in range(len(S)):
    char = chr(A + (ord(S[i])+N-A)%26)
    ans += char
print(ans)

Submission status: Accepted

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

ls = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'*2

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

Submission status: Accepted

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

for i in s:
    l.append(chr((ord(i) - 65 + n) % 26 + 65))
print(*l, sep="")

Submission status: Accepted

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

ans = ''
for i in S:
    n = ord(i) + N
    if n > 90:
        n -= 26
    ans += chr(n)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
alp = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
S_a = ""
for s in S:
    n = alp.index(s)+N 
    if(alp.index(s)+N>=26):
        n -= 26
    S_a += alp[n]
print(S_a)

Submission status: Accepted

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

ret = ""
for c in s:
	temp = ord(c) + n
	if (temp > 90): temp -= 26
	ret += chr(temp)

print(ret)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = ""
for i in range(len(s)):
    num = ord(s[i])
    if num + n > 90:
        num1 = (num+n)-90+64
    if num + n <= 90:
        num1 = num + n
    ans += chr(num1)
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()

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

Submission status: Accepted

Solution code:
N = int(input())

result = []

for c in input():
    r = ord(c) + N

    # Zを超えている
    if r > 90:
        r = 65 + r % 90 - 1

    result.append(chr(r))

print(''.join(result))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
a=ord("A")
z=ord("Z")
result=""
for i in range(len(S)):
    word=ord(S[i])+N
    if word>z:
        word=word-z-1+a
    x=chr(word)
    result+=x
print(result)

Submission status: Accepted

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

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

Submission status: Accepted

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

for 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-26))

print("".join(ans))

Submission status: Accepted

Solution code:
import string

n = int(input())
s = input()
ALPHABET = string.ascii_uppercase

ans = ''
for s_ in s:
    idx = ALPHABET.index(s_)
    idx_ = idx + n if idx + n < 26 else idx + n - 26
    ans += ALPHABET[idx_]
print(ans)

Submission status: Accepted

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

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

print(char)

Submission status: Accepted

Solution code:
N, S = [input() for _ in range(2)]
X = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Y = ""
for s in S:
  Y += X[(X.index(s)+int(N))%26]
print(Y)

Submission status: Accepted

Solution code:
a = int(input())
b = input()
for i in range(0, len(b)):
    c = ord(b[i])
    d = int(c+a)
    if d>90:
        d -= 26
    e = chr(d)
    print(e, end="")

Submission status: Accepted

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

Submission status: Accepted

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

print(*[alphabet[(alphabet.index(s) + N) % 26] for s in S], sep='')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = [chr(ord(s_)+n) if (ord(s_)+n)<91 else chr((ord(s_)+n)-26) for s_ in s ]
print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
for i in s:
    i = ord(i) + n
    if (i > 90):
        d = i - 90
        print(chr(64+d),end = '')
    else:
        print(chr(i),end = '')

Submission status: Accepted

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

def rot(c, r):
    base = 65
    return chr((ord(c)-base+r)%26+base)

print(''.join([rot(i, n) for i in s]))

Submission status: Accepted

Solution code:
roma = [chr(ord('A') + i) for i in range(26)] + [chr(ord('A') + i) for i in range(26)]
n = int(input())
s = list(input())
for j in s:
  print(roma[roma.index(j) + n], end="")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
 
def ROTN(tmp, n):
    tmp = ord(tmp) + n
    if tmp > 0x5a:
        tmp -= 26
    return chr(tmp)
 
 
ans = []
for i in range(len(s)):
    tmp = s[i]
    ans.append(ROTN(tmp, n))
 
for i in range(len(ans)):
    print(ans[i], end="")

Submission status: Accepted

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

def ROTN(tmp, n):
    tmp = ord(tmp) + n
    if tmp > 0x5a:
        tmp -= 26
    return chr(tmp)


ans = []
for i in range(len(s)):
    tmp = s[i]
    ans.append(ROTN(tmp, n))

for i in range(len(ans)):
    print(ans[i], end="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os, sys, re, math, string

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

a = string.ascii_uppercase * 2
print(''.join([a[a.index(s) + (N % 26)] for s in S]))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
print(''.join([t[t.index(c) + n] for c in s ]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S_ord = [ord(i) for i in input()]
S_ord_change = [65 + (i + N - 65) % 26 for i in S_ord]
S_change = [chr(i) for i in S_ord_change]
result = ''.join(S_change)
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

ret = ""
retc = ''
for i in range(len(s)):
    c = ord(s[i])
    if c + n > ord('Z'):
        retc = c + n - ord('Z') + ord('A') - 1
    else:
        retc = c + n
    ret += chr(retc)

print("{}".format(ret))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    s = input()
    for i in s:
        mod = (ord(i) - ord('A') + n) % 26
        ans = chr(ord('A') + mod)
        print(ans, end='')
        
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
S_ord = [ord(i) for i in input()]
S_ord_change = []
for i in S_ord:
    i += N
    if i >= 91:
        i = i - 26
    S_ord_change.append(i)

S_change_chr = [chr(i) for i in S_ord_change]
result = ''.join(S_change_chr)
print(result)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from string import ascii_uppercase

letters = ascii_uppercase + ascii_uppercase
shift = int(input())
s = input()[:-1]
for char in s: print(letters[letters.index(char) + shift], end = '')
print()

Submission status: Accepted

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

ans = ""

# A is 65 in unicode
# Z is 90 in unicode
for i in S_list:
    if 90 < ord(i) + N:
        ans += chr(ord(i) + N - 26)
    else:
        ans += chr(ord(i) + N)

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
s = input()
print(*[chr((ord(i) + n - 65) % 26 + 65)for i in s], sep="")

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
# z=90=>65
for i in s:
  x=ord(i)
  y=x+n
  if y>90:
    z=chr(y-26)
  else:
    z=chr(y)
  print(z,end='')

Submission status: Accepted

Solution code:
import sys
from string import ascii_uppercase

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    S = readline().strip()

    ans = [0] * len(S)
    for i, c in enumerate(S):
        ans[i] = ascii_uppercase[(ascii_uppercase.index(c) + N) % 26]

    print(''.join(ans))
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    S = readline().strip()

    ans = [0] * len(S)
    for i, c in enumerate(S):
        ans[i] = chr((ord(c) - 65 + N) % 26 + 65)

    print(''.join(ans))
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

for s in S:
    seq = (ord(s) - ord("A") + n) % 26
    print(chr(ord("A")+seq), end="")

Submission status: Accepted

Solution code:
#import sys
import numpy as np
#from collections import defaultdict
#import math
#from collections import deque

#input = sys.stdin.readline
#import decimal

def main():
    N = int(input())
    S = input()
    S_new =""
    for i in range(len(S)):
         S_new +=chr((ord(S[i])+N-ord("A"))%26+ord("A"))
    print(S_new)
if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(len(s)):
    temp = ord(s[i]) +n
    if temp > 0x5a:
        temp -= 26
    ans.append(chr(temp))
    
for k in range(len(ans)):
    print(ans[k], end = "")

Submission status: Accepted

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

l = [chr(ord('A')+i) for i in range(26)]
p = []
for t in range(len(S)):
    for i in range(26):
        if S[t] == l[i]:
            k = (i+N)%26
            p.append(l[k])
print(''.join(map(str,p)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
for i in range(len(S)):
    a = ord(S[i])+N
    if a > ord('Z'):
        a -= 26
    print(chr(a),end ='')

Submission status: Accepted

Solution code:
alphabet = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(input())
S = input()
for i in S:
  print(alphabet[(alphabet.index(i)+N) % 26], end='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

S = input()

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)

li = []

for s in S:
    num = alpha2num(s)
    num += N
    num %= 26
    if num==0:
        num = 26
    ap = num2alpha(num)
    li.append(ap)


print("".join(li))

Submission status: Accepted

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

sl = list(s)

answer = ""
for i in s:
  t = ord(i)+n
  if t <= 90:
    answer += chr(t)
  else :
    answer += chr(ord("A") + abs(t-90)-1)

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(''.join(l))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = ""
for i in s:
  t = ord(i)+n
  if t <= 90:
    ans += chr(t)
  elif t > 90:
    ans += chr(ord("A")+(abs(90-t))-1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
S = list(str(input()))
ans = []
for s in S:
    i = ord(s)
    if i+N>90:
        i -= 26
    ans.append(chr(i+N))

print(''.join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
ans = ''
for i in S:
    text = ord(i)+N
    if(text>(ord('Z'))):
        text=text-26
    ans+=chr(text)
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    s = input()
    ans = ""
    for si in s:
        t = ord(si)+n
        t = t if t<=ord('Z') else ord('A')-1+t-ord('Z')
        ans += chr(t)
    print(ans)

main()

Submission status: Accepted

Solution code:
n = int(input())
ans = ""
for c in input():
    if ord(c)+n > 90:
        ans += chr(ord('A')+(abs(90-(ord(c)+n))-1))
    else:
        ans += chr(ord(c)+n)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alfa = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lis = []
for s in S:
    for i in range(26):
        if s == alfa[i]:
            lis.append((i+N)%26)
            break
for i in range(len(S)):
    print(alfa[lis[i]],end = '')

Submission status: Accepted

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

for i in S:
    m=(ord(i)-ord("A")+N)%26
    ans += chr(m+ord("A"))
print(ans)

Submission status: Accepted

Solution code:
i_n = int(input())
i_str = input()
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lastIndex = 26
resStr = ''

for i in i_str:
  targetIndex = alphabet.index(i)
  if targetIndex + i_n >= lastIndex:
    resStrIndex = targetIndex + i_n - lastIndex
  else:
    resStrIndex = targetIndex + i_n

  resStr += alphabet[resStrIndex]

print(resStr)

Submission status: Accepted

Solution code:
i_n = int(input())
i_str = input()
res_str = ""
for i in i_str:
  if ord(i)+i_n>90:
    res_str+=chr(ord(i)+i_n-26)
  else:
    res_str+=chr(ord(i)+i_n)
print(res_str)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n = int(input())
    S = input()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
res = ''
for i in s:
  ap = ord(i) + n
  if ap > ord('Z'):
    ap -= 26
  res += chr(ap)
print(res)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    s = input()
    ans = ""
    for i in range(len(s)):
        suuji = ord(s[i])
        tsugi = suuji + n
        if tsugi > 65+25:
            tsugi -= 26
        ans += chr(tsugi)
    print(ans)


    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

def push(chara, dig):
  if ord(chara) + dig > 90: return chr(64 + dig + ord(chara) -90)
  else: return chr(dig + ord(chara))
  
string = input()
e = ""
for i in range(0, len(string)):
  e = e + push(string[i], n)
  
print(e)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
for c in S:
    print(chr(ord(c) + N) if ord(c) + N <= 90 else chr(ord(c) + N - 26), end='')
print()

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

N = I()
S = LS2()
for i in range(len(S)):
    a = ord(S[i]) + N
    if a <= 90:
        S[i] = chr(a)
    else:
        S[i] = chr(a-26)

print(''.join(S))

Submission status: Accepted

Solution code:
n = int(input())
def split(para):
    return [char for char in para]
inp = split(para=input())
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(len(inp)):
    inp[i] = alpha[(alpha.index(inp[i])+n)%26]
joiner=""
print(joiner.join(inp))

Submission status: Accepted

Solution code:
# 146 B

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

for i in s:
    val = ord(i)
    if val + n > 90:
        ex = (val + n) - 90
        new = 64 + ex
        ans += chr(new)
    else:
        ans += chr(val + n)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
#アルファベットとすうじを対応させる辞書
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}
dic_items = {0:'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'}
ans =""
for i in range(len(s)):
  ans += dic_items[(dic[s[i]]+n)%26]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=input()
ans=''
for i in a:
    p=ord(i)+n
    if p>ord('Z'):
        p-=26
    ans+=chr(p)
print(ans)

Submission status: Accepted

Solution code:
alp=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T",\
"U","V","W","X","Y","Z","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())

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

print(("".join(s)).upper())

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = ""
for i in s:
    if (ord(i)+n) <= 90:
        ans += chr(ord(i)+n)
    else:
        ans += chr(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())
x=input()
X=[j for j in x]
for i in range(0,len(X)):
  n=(A.index(X[i])+N)%26
  X[i]=A[n]
Y=''
for i in X:
  Y+=i
print(Y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
x=N-((N//26)*26)
empty=[]
for i in S:
    if ord(i)+x>90:
        a=chr(ord(i)+x-26)
        empty.append(a)
    else:
        a=chr(ord(i)+x)
        empty.append(a)
y=''.join(empty)
print(y)

Submission status: Accepted

Solution code:
N = int(input())
S = list(ord(x) for x in input())
for T in range(0,len(S)):
    if S[T]+N>90:
        S[T] = chr(S[T]+N-26)
    else:
        S[T] = chr(S[T]+N)
print(''.join(S))

Submission status: Accepted

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

new_S = list()
for word in S:
    num = alpha.index(word)+N
    if num > 25:
        num -= 26
    new_S.append(alpha[num])
print(''.join(new_S))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ls = list(s)
alphabet = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
for i in range(len(s)):
    index = alphabet.index(ls[i])
    if index + n < 26:
        ls[i] = alphabet[index + n]
    else:
        ls[i] = alphabet[index + n - 26]
print(''.join(ls))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())
S=input()
s=list()
for i in S:
  temp=ord(i)+N
  if temp<=ord("Z"):
    s.append(chr(temp))
  else:
    s.append(chr(temp-(ord("Z")-ord("A"))-1))
for i in s:
  print(i,end="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
T = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
t = len(T)
n = len(S)
S2 = []
for i in range(n):
  for j in range(t):
    if S[i] == T[j]:
      a = T[(j+N)%t]
      S2.append(a)
      break
k = S2[0]
for i in range(1,n):
  k += S2[i]
print(k)