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())
S=input()

answer=[]
sumple=["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)):
    answer.append(sumple[(sumple.index(S[i])+N+1)%26-1])
print(''.join(map(str,answer)))

Submission status: Accepted

Solution code:
n=int(input())
C='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for c in input():
  print(C[(C.find(c)+n)%26],end="")
print()

Submission status: Accepted

Solution code:
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def anagram(l,n):
    newletter = uppercase[(uppercase.find(l) + n) % 26]
    return newletter

n = int(input())
string = input()
new_string = ''
for l in string:
    new_string += anagram(l, n)
    
print(new_string)

Submission status: Accepted

Solution code:
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

n = int(input())
s  = [alpha.index(i) for i in input()]

s = map(lambda x: (x+n)% 26, s)

ans = ""
for i in s:
    ans = ans + alpha[i]
    
print(ans)

Submission status: Accepted

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

num2alpha = lambda c: chr(c+64) if c <= 26 else chr(c+38)
alpha2num = lambda c: ord(c) - ord('A') + 1

SNUM = map(alpha2num, S)
print(''.join(list(map(lambda a: num2alpha(a + N), SNUM))))

Submission status: Accepted

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

tmplist = ['A', 'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
result = ''

for i in range(len(s)):
    tmp = tmplist.index(s[i])
    if tmp + n < 26:
        result += tmplist[tmp + n]
    else:
        result += tmplist[tmp + n - 26]

print(result)

Submission status: Accepted

Solution code:
def next_ord(s, N):
    candidate_ord = ord(s) + N
    if candidate_ord > ord('Z'):
        candidate_ord -= 26
    return candidate_ord


N = int(input())
alphabets = input()
print("".join([chr(next_ord(a, N)) for a in alphabets]))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import string
import sys
from itertools import chain, dropwhile, takewhile

INF = float("inf")


def read(
    *shape, f=int, it=chain.from_iterable(sys.stdin), whitespaces=set(string.whitespace)
):
    def read_word():
        w = lambda c: c in whitespaces
        nw = lambda c: c not in whitespaces
        return f("".join(takewhile(nw, dropwhile(w, it))))

    if not shape:
        return read_word()
    elif len(shape) == 1:
        return [read_word() for _ in range(shape[0])]
    elif len(shape) == 2:
        return [[read_word() for _ in range(shape[1])] for _ in range(shape[0])]


def readi(*shape):
    return read(*shape)


def readi1(*shape):
    return [i - 1 for i in readi(*shape)]


def readf(*shape):
    return read(*shape, f=float)


def reads(*shape):
    return read(*shape, f=str)


def arr(*shape, fill_value=0):
    if len(shape) == 1:
        return [fill_value] * shape[0]
    elif len(shape) == 2:
        return [[fill_value] * shape[1] for _ in range(shape[0])]


def dbg(**kwargs):
    print(
        ", ".join("{} = {}".format(k, repr(v)) for k, v in kwargs.items()),
        file=sys.stderr,
    )


def main():
    N = readi()
    S = reads()
    print("".join(chr((ord(c) + N + 13) % 26 + 65) for c in S))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
l=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
for i in range(len(S)):
  for L in l:
    if S[i]==L:
      S[i]=l[(l.index(L)+N)%len(l)]
      break
print("".join(S))

Submission status: Accepted

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

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

print(''.join(cnt))

Submission status: Accepted

Solution code:
def myinput():
    n = int(input())
    s = input()
    return n, s

def rot(n, s):
    z = ord('Z')
    chars = []

    for c in s:
        code = ord(c) + n
        if code > z:
            code -= 26
        chars.append(chr(code))
    return ''.join(chars)

def main():
    n, s = myinput()
    ret = rot(n, s)
    print(ret)

main()

Submission status: Accepted

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from itertools import permutations, combinations,combinations_with_replacement,product
from fractions import Fraction as frac
import bisect
import heapq

import logging
logging.basicConfig(level=logging.DEBUG)

import sys
#input = sys.stdin.readline().rstrip

setrecursionlimit(1000000)

MOD = 10**9+7
INF = float('inf')

def main():
    N=int(input())
    S=input()
    A='ABCDEFGHIJKLMNOPQRSTUVWXYZ'

    ans=[]
    for c in S:
        i=A.index(c)
        ans.append(A[(i+N)%26])
    print("".join(ans))
main()

Submission status: Accepted

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

l=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

ans=""

for a in s:
  index = l.index(a)
  index=(index+n)%26
  ans += l[index]

print(ans)

Submission status: Accepted

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

for i in range(len(S)):
    index = alphabets.index(S[i])
    moved = index+N
    if 25 < moved:
        moved = moved-26
    S[i] = alphabets[moved]
print(*S,sep="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
import string
alist = list(string.ascii_uppercase)
adict = {"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}
ans = []
for s in S:
  i = adict[s]
  r = ""
  if i + N > 25:
    r = alist[i + N - 26]
  else:
    r = alist[i + N]
  ans.append(r)
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

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


def solve(N: int, S: str):
    for i in range(len(S)):
        print( chr( (ord(S[i]) + N - ord('A')) % 26 + ord('A') ), end="")
    print()
    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:
N = int(input())
S = list(input())
order = tuple(list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'))
for i in range(len(S)):
    S[i] = order[(order.index(S[i])+N)%26]
print(''.join(S))

Submission status: Accepted

Solution code:
# coding: utf-8
# ABC146B

alpha = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
n = int(input())
s = list(input())

res = []
for i in s[:]:
    idx = (alpha.index(i) + n) % len(alpha)
    res.append(alpha[idx])

print(''.join(res))

Submission status: Accepted

Solution code:
def num():
    return int(input())

def nums():
    return list(map(int,input().split(" ")))

#A
"""
date = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print(date[input()])
"""
#B
import string as s
N,S = num(),input()
letters = s.ascii_uppercase
ans = ""
for i in S:
    ans += letters[(letters.index(i)+N)%len(letters)]
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
def caeser(S,n):
  r = []
  for s in S:
    if ('A' <= s and s <= 'Z'):
      r.append(chr((ord(s) - ord('A') + n) % 26 + ord('A')))
    # a - z
    elif ('a' <= s and s <= 'z'):
      r.append(chr((ord(s) - ord('a') + n) % 26 + ord('a')))
  return "".join(r)
  
print(caeser(S,N))

Submission status: Accepted

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

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

S2=[]

for i in S:
    i=upper[(upper.index(i)+N)%26]
    S2.append(i)

print(''.join(S2))

Submission status: Accepted

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

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

print(*S,sep="")

Submission status: Accepted

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

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

for i in range(len(S)):
	out += chr(S[i])

print(''.join(out))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
nums = []
for string in s:
    cache = ord(string) + n
    if cache > 90:
        cache -= 26
    nums.append(chr(cache))
print(*nums, sep="")

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(64+ord(s[i])+n-90)

print(*s,sep='')

Submission status: Accepted

Solution code:
n  = int(input())
#a = list(map(int,input().split()))
s = input()
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans=""
for i in range(len(s)):
    idx=0
    idx = alp.find(s[i])
    idx = (idx + n)%26
    ans = ans+alp[idx]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = ""
for c in s:
	o = ord(c)
	o = chr(o+n)
	if o<='Z':
		ans = ans + o
	else:
		o = ord(o)-91
		# print(o)
		o = 65+o
		ans = ans + chr(o)

print(ans)

Submission status: Accepted

Solution code:
shift_num=input()
input_line=input()

character_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':26}
new_line=''
for item in input_line:
  char_index=int(character_dict[item])+int(shift_num)
  if char_index>26:
    for key, value in character_dict.items():
      if value == (char_index-26):
        new_line=new_line+str(key)
  else:
    for key, value in character_dict.items():
      if value == (char_index):
        new_line=new_line+str(key)
print (new_line)

Submission status: Accepted

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

a_ascii = ord("A")
z_ascii = ord("Z")
ans = ""

for c in S:
    new_ascii = ord(c) + N
    if new_ascii > z_ascii:
        new_ascii = new_ascii - 26
    ans += chr(new_ascii)

print(ans)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    A = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    R = A[n:] + A[:n]
    M = {A[i]: R[i] for i in range(26)}
    ans = ""
    for s in input():
        ans += M[s]
    print(ans)
solve()

Submission status: Accepted

Solution code:
import string
n=int(input())
s=input()
lst=[]
for i in s:
    ind=string.ascii_uppercase.index(i)+n
    while(ind >25):
        ind=(string.ascii_uppercase.index(i)+n) -26
    lst.append(string.ascii_uppercase[ind])

print(''.join(lst))

Submission status: Accepted

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

length_S = len(S)

alpha = [chr(i) for i in range(ord('A'), ord('Z')+1)]

X = ''

for i in range(length_S):
    s = S[i]
    index_alpha = alpha.index(s)

    if index_alpha + N >= 26:
        num = index_alpha + N - 26
        new_s = alpha[num]
    else:
        num = index_alpha + N
        new_s = alpha[num]

    X = X + new_s

print(X)

Submission status: Accepted

Solution code:
import string
N = int(input())
S = str(input())
arr = [chr(i) for i in range(65, 65+26)]*2
arr = "".join(arr)
new_arr = ""
for s in S:
  idx = arr.find(s)
  s = arr[idx+N]
  new_arr += s
print(new_arr)

Submission status: Accepted

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


PLAIN = s

KEY = n

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:
n= int(input())
s=input()
m = list(s)
p=[]
for i in m:
  p.append(chr(65 + (ord(i)-65+n)%26))
for t in p:
  print(t,end="")

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys
import random
import itertools
import math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt


def LI(): return list(map(int, input().split()))


def LF(): return list(map(float, input().split()))


def LI_(): return list(map(lambda x: int(x)-1, input().split()))


def II(): return int(input())


def IF(): return float(input())


def LS(): return list(map(list, input().split()))


def S(): return list(input().rstrip())


def IR(n): return [II() for _ in range(n)]


def LIR(n): return [LI() for _ in range(n)]


def FR(n): return [IF() for _ in range(n)]


def LFR(n): return [LI() for _ in range(n)]


def LIR_(n): return [LI_() for _ in range(n)]


def SR(n): return [S() for _ in range(n)]


def LSR(n): return [LS() for _ in range(n)]


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]


def sosu(x):
    for i in range(2, int(sqrt(x)+1)):
        if x % i == 0:
            return False
    return True


mod = 1000000007
inf = float('INF')


def A():
    youbi = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']
    S = input()
    S=S[:-1]
    print(7-youbi.index(S))

    return

# B


def B():
    abc=['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 = II()
    S = input()
    S=S[:-1]
    ans='a'
    for i in S:
        x=abc.index(i)+N
        if x>25:
            x=x-26
        ans+=abc[x]
    ans=ans[1:]
    print(ans)
    return

# C


def C():
    N = II()
    x = [0]*N
    y = [0]*N
    for i in range(N):
        x[i], y[i] = LI()
    ans = 0
    for j in range(N-1):
        for k in range(j+1, N):
            len = sqrt(((x[j]-x[k])*(x[j]-x[k]))+((y[j]-y[k])*(y[j]-y[k])))
            ans += len
    ans = ans*2/N
    print(ans)

    return

# D


def D():

    a, b, x = LI()
    BIG = a*a*b/2
    if x > BIG:
        y = 2*b-(2*x/a/a)
        print(math.degrees(math.atan(y/a)))
    else:
        y = 2*x/a/b
        print(math.degrees(math.atan(b/y)))
    return

# E


def E():
    N, K = LI()
    A = LI()
    F = LI()
    A.sort(reverse=True)
    F.sort()
    cost = []
    for i in range(len(N)):
        cost.append(A[i]*F[i])

    a = F[cost.index(max(cost))]

    return

# F


def F():
    N, M = LI()

    value = [0] * M
    power = [0] * M
    for i in range(M):
        a, b = LI()
        value[i] = a
        c = LI()
        L = ['0'] * N
        for k in c:
            L[k - 1] = '1'
        bint = ''.join(L)
        power[i] = int(bint, 2)
    bint = ''.join(list(['1'] * N))
    dp = [inf] * (int(bint, 2)+1)
    t = 0
    cost = 0

    dp[0] = 0
    for s in range(int(bint, 2) + 1):
        for i in range(M):
            t = s | power[i]
            cost = dp[s] + value[i]
            dp[t] = min(dp[t], cost)
    print(-1) if(dp[-1] == inf) else print(dp[-1])

    return

    # you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")


def solution(S):
    # write your code in Python 3.6
    N = len(S)

    pass


# Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

int_ = list(map(lambda x: int(hex(ord(x)),16), S))
incre_ = list(map(lambda x: x+N, int_))
incre_ = [x if x <= 90 else x - 26 for x in incre_]
str_ = list(map(lambda x: chr(x), incre_))
print(''.join(str_))

Submission status: Accepted

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

a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
aa = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

res = ''

for i in range(len(s)):
    b = a.find(s[i])
    res += aa[b + n]

print(res)

Submission status: Accepted

Solution code:
num = int(input())
list = input()
p = ["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"]
l = []
o = ""
for i in range(0,len(list)):
  for t in range(0,26):
    if list[i] == p[t]:
      u = t+num
      if t+num>=26:
        u = (t+num)%26
      l.append(u)

for s in range(0,len(list)):
  o += p[l[s]]
  
print(o)

Submission status: Accepted

Solution code:
def _rot13(c,N):
    if 'A' <= c and c <= 'Z':
        # 13 文字分ずらす
        return chr((ord(c) - ord('A') + N) % 26 + ord('A'))

    if 'a' <= c and c <= 'z':
        # 13 文字分ずらす
        return chr((ord(c) - ord('a') + N) % 26 + ord('a'))

    # その他の文字は対象外
    return c


def rot13(s,N):
    # ジェネレータ内包表記で文字列に ROT13 を適用する
    g = (_rot13(c,N) for c in s)
    # 文字列に直す
    return ''.join(g)


def main():
    N = int(input())
    s = input()
    print(rot13(s,N))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
s=input()
s_li=list(s)
li=[chr(ord('A')+i) for i in range(26)]*2
ans_li=[]
for i in range(len(s_li)):
    a=li.index(s_li[i])
    ans_li.append(li[a+n])
ans=''
for i in ans_li:
    ans+=i
print(ans)

Submission status: Accepted

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

alpha=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']*2
anslist=[alpha[ord(i)-65+N] for i in S]
print(''.join(anslist))

Submission status: Accepted

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

for i in s:
  if ord(i) + n <= 90:
    print(chr(ord(i) + n), end="")
  else:
    print(chr(ord(i) + n -26), end="")

Submission status: Accepted

Solution code:
N=int(input())
S=input()
S=list(S)
p=[]
A=list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
for i in S:
  for j,a in enumerate(A):
    if i==a:
      p.append(A[j+N])
      break
print(''.join(list(p)))

Submission status: Accepted

Solution code:
"""
ROT N
https://atcoder.jp/contests/abc146/tasks/abc146_b
"""

import sys
input = sys.stdin.readline

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

alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

ans = []
for s in S:
    for i, char in enumerate(alphabet):
        if s == char:
            ans.append(i)
            break

for item in ans:
    print(alphabet[item + N], end="")
print()

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
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']
for i in range(len(S)):
    for j in range(len(alp)):
        if alp[j] == S[i]:
            ans = int((j + N) % len(alp))
            S[i] = alp[ans]
            break
        else:
            continue
print(''.join(S))

Submission status: Accepted

Solution code:
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)

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

ans = []
for w in s:
    num = (alpha2num(w) + n)
    if (num % 27) == 0:
        num = 1
    elif num // 27 > 0:
        num = (num % 27) + 1
    else:
        num = (num % 27)
    tmp = num2alpha(num)
    ans.append(tmp)
    
print("".join(ans))

Submission status: Accepted

Solution code:
AZ_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"]
N = int(input())
S = list(input())
for s in S:
    new_index = AZ_list.index(s) + N
    if new_index > 25:
        new_index -= 26
    print(AZ_list[new_index], end='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
 
res = list()
 
strings = [chr(i) for i in range(65, 65+26)]
for s in S:
  ind = strings.index(s) + N
  res.append(strings[ind % len(strings)])
  
print(''.join(map(str, res)))

Submission status: Accepted

Solution code:
from copy import copy
N = int(input())
S = input()

alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

ans = copy(S)



for i in range(len(S)):
    ans = ans[:i] + alpha[alpha.index(S[i]) + N] + ans[i+1:]

print(ans)

Submission status: Accepted

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

ans=''
for i in range(len(s)):
    a=l.index(s[i])
    if a+n<=25:
        ans+=l[a+n]
    else:
        ans+=l[a+n-26]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
o = int()
s = list(s)
for i, youso in enumerate(s):
    o = ord(youso)
    if o+n>90:
        s[i] = chr(64 + n-(90-o))
    else:
        s[i] = chr(o + n)
print("".join(s))

Submission status: Accepted

Solution code:
n=int(input())
s=input().lower()
ans=''
for char in list(s):
    a=ord(char)
    num=a-97
    num=(num+n)%26
    a=num+97
    ans+=chr(a)
print(ans.upper())

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ret)

Submission status: Accepted

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

for i in S:
  tmp = (ord(i)-ord("A") + N)
  if tmp >= 26:
    tmp = tmp %26 
  print(chr(tmp + ord("A")),end='')

Submission status: Accepted

Solution code:
import string
num = int(input())
S = [i for i in input()]
res = ''
abc_list = [i for i in string.ascii_uppercase]

for i in S:
    new_index = (abc_list.index(i) + num ) % 26
    res += abc_list[new_index]

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
li = ["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"]
num = int(input())
inputs = input()
char = ""
char_list = list(inputs)
for x in char_list:
    pos = li.index(x)
    pos += num
    while pos >= 26:
        pos -= 26
    char += li[pos]

print(char)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
alps = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
ans = []
for i in S:
  index = alps.index(i) + N
  ans.append(alps[index])
print(''.join(ans))

Submission status: Accepted

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

alpha_dict = {}
for i,c in enumerate(range(ord('A'),ord('Z')+1)):
    alpha_dict[i+1] = chr(c)
    
new_s = []
for s in sList:
    key = [k for k, v in alpha_dict.items() if v == s][0]
    key = key + n
    if key > 26:
        key -= 26
    new_s.append(alpha_dict[key])
new_s = "".join(new_s)
print(new_s)

Submission status: Accepted

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

X = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
x = {}
for i in range(26):
    x[X[i]] = i
ans = ''
for i in range(len(S)):
    ans += X[(x[S[i]]+N)%26]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
d = {s: t for s, t in zip("ABCDEFGHIJKLMNOPQRSTUVWXYZ", a[N:] + a[:N])}
print("".join(d[s] for s in S))

Submission status: Accepted

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

for k in range(len(s)):
    for l in range(26):
        if s[k] == alf[l]:
            s[k] = alf[l + n]
            break
s = "".join(s)
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
ln = len(s)
alph = [
    "A",
    "B",
    "C",
    "D",
    "E",
    "F",
    "G",
    "H",
    "I",
    "J",
    "K",
    "L",
    "M",
    "N",
    "O",
    "P",
    "Q",
    "R",
    "S",
    "T",
    "U",
    "V",
    "W",
    "X",
    "Y",
    "Z",
]

ans = []
for i in range(ln):
    ind = alph.index(s[i])
    newind = ind + n
    if newind > 25:
        newind = newind - 26
    ans.append(alph[newind])

print("".join(ans))

Submission status: Accepted

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

out = ''
for char in s:
    i = ord(char)
    if i+n > 90:
        out += chr(i+n-26)
    else:
        out += chr(i+n)
print(out)

Submission status: Accepted

Solution code:

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

charc = ['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)):
    Si = S[i]
    ind = charc.index(Si)
    if ind + N <= 25:
        ans.append(charc[ind+N])
    else:
        ind = ind + N - 26
        ans.append(charc[ind])
    
print(''.join(ans))

Submission status: Accepted

Solution code:
#chr(num)文字
#ord(文字)数値
#ord("A") = 65
n = int(input())
s = input()
r = 65





lst = []
for c in s:
    new_character = chr((ord(c)-65+n)%26+65)
    lst.append(new_character)

print("".join(lst))

Submission status: Accepted

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

#a,b = map(int,input().split())
#li = list(map(int,input().split()))
W = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","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)):
    ans += W[W.index(s[i])+n]
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 



n = int(input())
#n,m = [int(i) for i in input().split()]
#ab = [[int(i) for i in input().split()] for _ in range(n-1)]

s = input()

ans = []

x = ord("A")
for i in s:
    c = ord(i) + n
    if c > ord("Z"): c -= 26
    ans.append(chr(c))

print("".join(ans))

Submission status: Accepted

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

a = ""
for i in s:
    if ord(i) + n <= 90:
        a += chr(ord(i) + n)

    else:
        a += chr(ord(i) + n - 26)

print(a)

Submission status: Accepted

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

al = [chr(i) for i in range(ord('A'), ord('Z')+1)]

newlist = ''

for i in w:
  index = al.index(i)
  new = index + N
  if new > 25:
    new = new - 26
  newlist += al[new]
  

print(newlist)

Submission status: Accepted

Solution code:
import string

N = int(raw_input())
S = raw_input()

letters = string.ascii_uppercase * 2

print ''.join(letters[letters.index(c) + N] for c in S)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
A = list(map(lambda x:ord(x)+N,S))
for i in range(len(A)):
    if A[i] > 90:
         A[i] = A[i] - 26
B = list(map(lambda x:chr(x),A))
print("".join(B))

Submission status: Accepted

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

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

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

RESULT = ""
n = 0

for i in range(0, len(S)):
  n = ALIST[S[i]] + N
  if n > 26:
    n -= 26
  RESULT += RLIST[n]

print(RESULT)

Submission status: Accepted

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

ans = []
for s in S:
    if ord(s) + N <= 90:
        ans.append(chr(ord(s) + N))
    else:
        ans.append(chr(ord(s) + N - 26))
print("".join(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import sys
f = sys.stdin
n = int(f.readline())
s = list(map(ord, list(f.readline())[:-1]))
# A=65 Z=90
s = [chr((a - 65 + n) % 26 + 65) for a in s]
s = ''.join(s)

print(s)

Submission status: Accepted

Solution code:
N=int(input())
print(''.join(map(lambda s:chr((ord(s)-ord('A')+N)%26+ord('A')),input())))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
dic = ['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 S:
    if dic.index(i)+N <= 25:
        index = dic.index(i)+N
    else:
        index = dic.index(i)+N-26
    ans += dic[index]
print(ans)

Submission status: Accepted

Solution code:
import sys
import string
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline

N = int(input())
S = input().rstrip('\n')

ans = ""

letters = list(string.ascii_uppercase)
for s in S:
    tmp = letters.index(s)
    ans += letters[(tmp + N) % 26]

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
s=list(str(input()))
char=[chr(i) for i in range(65, 65+26)]
for i in range(len(s)):
  s[i]=char.index(s[i])+N
  if s[i]>=26:
    s[i]-=26
  s[i]=char[s[i]]
print(''.join(s))