Problem:


Score : 200 points

Problem Statement

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

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

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

Constraints

0 \leq N \leq 26

1 \leq |S| \leq 10^4

S consists of uppercase English letters.

Input

Input is given from Standard Input in the following format:

N
S

Output

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

Sample Input 1

2
ABCXYZ

Sample Output 1

CDEZAB

Note that A follows Z.

Sample Input 2

0
ABCXYZ

Sample Output 2

ABCXYZ

Sample Input 3

13
ABCDEFGHIJKLMNOPQRSTUVWXYZ

Sample Output 3

NOPQRSTUVWXYZABCDEFGHIJKLM



Sample input:
2
ABCXYZ


Sample output:
CDEZAB

Submission status: Accepted

Solution code:
import math
N =  int(input())
S = list(input())
ans = []
for c in S:
    num = ord(c)
    num -= 65
    num += N
    num %=26
    num += 97
    ans.append(chr(num))
print("".join(ans).upper())

Submission status: Accepted

Solution code:
import string

dic = {i: c for i, c in enumerate(string.ascii_uppercase)}
dic_inv = {c: i for i, c in enumerate(string.ascii_uppercase)}
length = len(string.ascii_uppercase)

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

s_new = [dic[(dic_inv[c] + n) % length] for c in s]
print(''.join(s_new))

Submission status: Accepted

Solution code:
def p_b():
    t = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    n = int(input())
    s = input()
    for i in list(s):
        print(t[(t.index(i) + n) % len(t)], end="")
    print()
    
p_b()

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()

alp = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

s_t = ''
for x in s:
  s_t += alp[(alp.index(x) + n) % 26]
  
print(s_t)

Submission status: Accepted

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

Submission status: Accepted

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

ans = ""
A = ord('A')
Z = ord('Z')
for s in S:
    t = ord(s)
    t = ((t-A+N) % (Z-A+1)) + A
    t = chr(t)
    ans += t
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()
S = str(input())
T = str()

for i in range(len(S)):
    x = ord(S[i])-ord('A')+N
    if x<=25:
        T += chr(ord('A')+x)
    else:
        T += chr(ord('A')+x-26)

print(T)

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 i in range(len(S)):
    idx = L.index(S[i])
    idx += N
    idx %= 26
    ans.append(L[idx])
    
print("".join(ans))

Submission status: Accepted

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

#!/usr/bin/env python
def caesar(s, n):
    ns = []
    for ch in s:
        # A - Z
        if ('A' <= ch and ch <= 'Z'):
            ns.append(chr((ord(ch) - ord('A') + n) % 26 + ord('A')))
        # a - z
        elif ('a' <= ch and ch <= 'z'):
            ns.append(chr((ord(ch) - ord('a') + n) % 26 + ord('a')))
        # 0 - 9
        elif ('0' <= ch and ch <= '9'):
            ns.append(chr((ord(ch) - ord('0') + n) % 10 + ord('0')))
        # no change for other characters
        else:
            ns.append(ch)
    return "".join(ns)

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

Submission status: Accepted

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

ans = ''
for s in S:
    c = ord(s)+N
    if c > ord('Z'):
        c = ord('A')+c-ord('Z')-1
    ans += chr(c)

print(ans)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
  n = ni()
  s = ns()
  ans = ""
  for ss in s:
    x = ord(ss) + n
    if x > 90:
      x -= 26
    ans += chr(x)
  print(ans)

if __name__ == '__main__':
  main()

Submission status: Accepted

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

n = int(input())
string = input()

output = ''
for s in string:
    for i in range(26):
        if alphabet[i] == s:
            output += alphabet[i + n]

print(output)

Submission status: Accepted

Solution code:
import string
letters=string.ascii_letters.upper()
n=int(input())
s=input()
ans=''
for c in s:
    ans+=letters[letters.find(c)+n]
print(ans)

Submission status: Accepted

Solution code:
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
d1 = {}
d2 = {}
for i in range(26):
    d1[i] = alp[i]
    d2[alp[i]] = i
N = int(input())
S = input()
ans = []
for i in range(len(S)):
    s = S[i]
    n = d2[s]
    n += N
    n %= 26
    ans.append(d1[n])
print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
import collections
import sys
base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
ret = ''
for c in S:
    K = base.find(c)
    ret += base[K+N]
print(ret)

Submission status: Accepted

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

def caesar(s, n):
    ns = []
    for ch in s:
        # A - Z
        if ('A' <= ch and ch <= 'Z'):
            ns.append(chr((ord(ch) - ord('A') - n) % 26 + ord('A')))
        # a - z
        elif ('a' <= ch and ch <= 'z'):
            ns.append(chr((ord(ch) - ord('a') - n) % 26 + ord('a')))
        # 0 - 9
        elif ('0' <= ch and ch <= '9'):
            ns.append(chr((ord(ch) - ord('0') - n) % 10 + ord('0')))
        # no change for other characters
        else:
            ns.append(ch)
    return "".join(ns)

print(caesar(s,26-n))

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"]
res = ""
for s in S:
    moto_index = X.index(s)
    index = moto_index+N
    if(index >= 26):
        index -= 26
    res += X[index]
print(res)

Submission status: Accepted

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

chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
chars = chars + chars + chars

out = ""
for c in s:
    i = chars.index(c)
    outc = chars[i+n]
    out += outc
print(out)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Al = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = int(input())
S = input()
ans = ""
for c in S:
    ans += Al[Al.index(c)+n]
print(ans)

Submission status: Accepted

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

ordA = ord('A')

ans = ''
for S in Ss:
    i = ord(S) - ordA
    i = (i+N) % 26
    ans += chr(ordA + i)

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
def f(c):
    return chr(ord(c)+N) if ord(c)+N<=ord('Z') else chr(ord(c)-26+N)
print(*[f(c) for c in S],sep='')

Submission status: Accepted

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

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

Submission status: Accepted

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

alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alpha2=alpha*2
ans=""
for ss in s:
    ans+=alpha2[alpha.index(ss)+n] 
print(ans)

Submission status: Accepted

Solution code:
import string
N = int(input())
S = input()
abcn = string.ascii_uppercase[N:] + string.ascii_uppercase[:N]
o_n = {o: n for o, n in zip(string.ascii_uppercase, abcn)}
print(''.join([o_n[s] for s in S]))

Submission status: Accepted

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

from string import  ascii_uppercase

X = ascii_uppercase + ascii_uppercase

pos = {}

for i, s in enumerate(ascii_uppercase):
    pos[s] = i

ans = ""

for s in S:
    p = pos[s] + N
    ans += X[p]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""

for a in s:
  idx = (alp.find(a)+n) % len(alp)
  ans += alp[idx]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

num2alpha = lambda c:chr(c+65)
alpha2num = lambda c:ord(c) - ord('A')

ans = ['A']*len(S)
for i in range(len(S)):
    tmp = alpha2num(S[i])
    tmp += N
    tmp %= 26
    c = num2alpha(tmp)
    ans[i] = c

print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
hirabun = input()
A = list(range(65,91))


def enc(m):
    hira   = list(m.encode("ascii"))
    ango   = hira.copy()
    for i, code in enumerate(hira):
        if 65 <= code <= 91:
            ango[i] = A[ (A.index(code) + n) % 26]
    c = bytes(ango).decode("ascii") 
    return c

angobun = enc(hirabun)
print(angobun)

Submission status: Accepted

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

for x in input():
    print(s[(s.index(x) + n) % 26], end = '')

Submission status: Accepted

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

result = ''
l = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
n = len(l)

for s in S:
  result += l[(l.index(s) + N)%n]

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  n = int(input())
  v = input().strip()
  r = ''.join(s[(s.index(x) + n) % 26] for x in v)

  print(r)


if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
newS = []
for i in s:
    new = chr(ord(i) + n)
    if new > "Z":
        new = chr(ord(i) + n - 26)
    newS.append(new)

for i in newS:
    print(i, end = "")
print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [chr(c) for c in range(ord('A'), ord('Z')+1)]
N = int(input())
S = list(input())
ans = [l[(l.index(c) + N) % 26] for c in S]
print("".join(ans))

Submission status: Accepted

Solution code:
from string import ascii_uppercase

uppers = ascii_uppercase + ascii_uppercase
N = int(input())
S = input().strip()

ans = ''
for s in S:
    idx = ascii_uppercase.find(s)
    ans += uppers[idx+N]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
#print(ord("Z"))
S=[chr(ord(i)+N) if ord(i)+N<=90 else chr(ord(i)+N-26) for i in S]
print("".join(S))



#[ord("a") for i in range(26)]

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
a = ord("A")
b = ord("Z")
ans = ""
for i in range(len(s)):
    x = ord(s[i])
    x +=n
    if x>b:
        x = x-b+a-1
    ans += chr(x)
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


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


print(ans)

Submission status: Accepted

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

v = []

for c in s:
    for i in range(26):
        if t[i] == c:
            v.append(t[i + n])

print(''.join(v))
exit(0)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
import sys
import bisect
import math
import itertools
import string
import queue
import copy
# import numpy as np
# import scipy
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
 
def inp(): # n=1
    return int(input())
def inpm(): # x=1,y=2
    return map(int,input().split())
def inpl(): # a=[1,2,3,4,5,...,n]
    return list(map(int, input().split()))
def inpls(): # a=['1','2','3',...,'n']
    return list(input().split())
def inplm(n): # x=[] 複数行
    return list(int(input()) for _ in range(n))
def inpll(n): # [[1,1,1,1],[2,2,2,2],[3,3,3,3]]
    return [list(map(int, input().split())) for _ in range(n)]

def main():
    n=inp()
    s=list(input())
    for i in range(len(s)):
        x = ord(s[i])
        x+=n
        if x>=91:
            x-=26
        s[i]=chr(x)
    print(''.join(s))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/python3

import os
import sys


def main():
    N = read_int()
    S = inp()
    print(solve(N, S))


def solve(N, S):
    ans = []
    orda = ord('A')
    for ch in S:
        ans.append(chr((ord(ch) - orda + N) % 26 + orda))

    return ''.join(ans)


###############################################################################

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    letters *= 2
    n = int(input())
    s = input()
    for i in s:
        print(letters[letters.index(i)+n],end = '')
    
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
a = ord("A")
S = input()

def b(x):
    return chr((ord(x)-a+N)%26+a)

print(''.join(map(str,map(b,list(S)))))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# aは97,zは122
N = int(input())
S = input()
S2 = []
for s in S:
    x = ord(s)
    x += N
    if x > 90:
        x -= 26
    S2.append(chr(x))

print(''.join(S2))

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
al=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
ans=[]
for i in range(len(s)):
    si=al.index(s[i])
    ans.append(al[(si+n)%26])
print(''.join(ans))

Submission status: Accepted

Solution code:
word_list = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
word_list.extend(word_list)
N = int(input())
S = input()
ans = ""
for i in range(len(S)):
    for j in range(len(word_list)):
        if S[i] == word_list[j]:
            ans += word_list[j+N]
            break
print(ans)

Submission status: Accepted

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

T=[chr(ord('A')+(ord(c)-ord('A')+N)%26) for c in S]

ans=''.join(T)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
T = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for e in S:
    ans += T[(N+ord(e)-65)%26]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
S_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for s in S:
    idx = S_list.index(s)+N
    if idx > 25:
        idx -= 26
    ans += S_list[idx]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
h = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
m = {}
for i in range(26):
  c = h[i]
  m[c] = i
L2 = []
for c in S:
  i = m[c]
  i2 = (i+N)%26
  c2 = h[i2]
  L2.append(c2)
print("".join(L2))

Submission status: Accepted

Solution code:
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = int(input())
s = input()
ans = ""
for si in s:
  ans += a[(a.index(si)+n) % len(a)]
print(ans)

Submission status: Accepted

Solution code:
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = input()
d = input()
print("".join([a[(a.index(x)+int(n))%len(a)] for x in d]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

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

alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def main():
    ids = {}
    for i in range(26):
        ids[alp[i]] = i
    n = ri()
    s = input()
    ans = ""
    for c in s:
        to = (ids[c]+n)%26
        ans += alp[to]
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = []
for i in range(len(S)):
    ans.append(alpha[(ord(S[i])-65+N)%26])
print(*ans, sep = '')

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=''
for i in range(len(S)):
    k = alp.find(S[i])
    ans += alp[(k+N)%26]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
offset = ord('A')
t = [(ord(c) - offset + n) % 26 + offset for c in s]
print(''.join(map(chr, t)))

Submission status: Accepted

Solution code:
alpha_dict = {}
for i,c in enumerate(range(ord('A'),ord('Z')+1)):
    alpha_dict[chr(c)] = i + 1
num_dict = {}
for i,c in enumerate(range(ord('A'),ord('Z')+1)):
    num_dict[i+1] = chr(c)

n = int(input())
inp = list(input())
ans = []
for al in inp:
  k = alpha_dict[al]
  k += n 
  if k > 26:
    k -= 26 
  ans += [num_dict[k]]
print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(raw_input())
s = raw_input()
ret = ""

for c in s:
    v = (ord(c) + n)
    if v > ord('Z'):
        v = (v - ord('Z')) + ord('A') - 1
    ret += chr(v)
print ret

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    *S,=ST()
    for i,s in enumerate(S):
        S[i] = chr((ord(s)+N-ord("A"))%26+ord("A"))
    print(*S,sep="")
if __name__ == '__main__':
    main()

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
s = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lst = list(alpha+alpha)
ans = ''
for i in range(len(s)):
    ans += lst[alpha.index(s[i])+n]
print(ans)

Submission status: Accepted

Solution code:
#B
N = int(input())
S = list(str(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"]
ans = ""
for s in S:
    ans+=A[(A.index(s)+N)%26]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input().strip()
AZ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

ans = ""
for c in S:
  n = ord(c) - ord('A') + N
  if n >= len(AZ):
    n -= len(AZ)
  ans += AZ[n]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
print(''.join(chr((ord(c)+n-65)%26+65)for c in input()))

Submission status: Accepted

Solution code:
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

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

lists="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
lists=list(lists)

max_len=len(lists)

N=one_int()
S=one_str()

N=N%max_len

output=[]
for s in list(S):
    index = lists.index(s)
    output.append(lists[(index+N)%max_len])
print("".join(output))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(input())
S = input()[:-1]

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

Submission status: Accepted

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


def solve(N: int, S: str):
    T = ''
    for s in S:
        T = T + chr((ord(s) + N - ord('A')) % 26 + ord('A'))
    print(T)
    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=input()
ng=len(s)

aslist=[]
for i in range(ng):
    ban=ord(s[i])
    if ban+n>=91:
        ban=ban+n-26
    else:
        ban=ban+n
    aslist.append(ban)

moji=''
for i in range(ng):
    moji+=chr(aslist[i])

#print(aslist)
print(moji)

Submission status: Accepted

Solution code:
# 平文
N = int(input())
S = input()

# 秘密鍵
KEY = N

# 以下に、記述してください。
enc = ""

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

print(enc)

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"]
for x in S:
	i =( L.index(x)+N) % 26
	print(L[i],end="")

Submission status: Accepted

Solution code:
N = int(input())
S = input()
enc = ""
for char in list(S):
    ASCII = ord(char)
    num = ASCII - 65
    num = (num + N) % 26
    ASCII = num + 65
    enc += chr(ASCII)

print(enc)

Submission status: Accepted

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

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:
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

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

print(''.join(chars[(chars.index(i) + n) % 26] for i in s))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
d = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = []
for c in s:
  ans.append(d[(d.index(c)+n)%26])
print(''.join(ans))

Submission status: Accepted

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

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

print ()

Submission status: Accepted

Solution code:
n=int(input())
s=input()
alp=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
ans=""
for c in s:
    ans+=alp[(alp.index(c)+n) % 26]

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
s = input()
def caesar(s, n):
    ns = []
    for ch in s:
        # A - Z
        if ('A' <= ch and ch <= 'Z'):
            ns.append(chr((ord(ch) - ord('A') + n) % 26 + ord('A')))
        # a - z
        elif ('a' <= ch and ch <= 'z'):
            ns.append(chr((ord(ch) - ord('a') + n) % 26 + ord('a')))
        # 0 - 9
        elif ('0' <= ch and ch <= '9'):
            ns.append(chr((ord(ch) - ord('0') + n) % 10 + ord('0')))
        # no change for other characters
        else:
            ns.append(ch)
    return "".join(ns)

result = caesar(s, N)
print(result)

Submission status: Accepted

Solution code:
N = int(input())
s = input()
ls = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ret=[]
for i in range(len(s)):
    ret.append(ls[(ls.index(s[i])+N)%26])
print(''.join(ret))

Submission status: Accepted

Solution code:
n=int(input())
s=input()
ans=''
ss='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in s:
    x=ss.index(i)
    ans+=ss[x+n]
print(ans)

Submission status: Accepted

Solution code:
ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
table = str.maketrans(ALPHA, ALPHA[N:] + ALPHA[:N])
result = S.translate(table)
print(result)

Submission status: Accepted

Solution code:
#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	S = list(input())
	M = len(S)
	for i in range(M):
		S[i] = chr((ord(S[i]) - 65 + N) % 26 + 65)
	print("".join(S))

# #大文字
# L = [chr(i) for i in range(65, 91)]
# #小文字
# L = [chr(i) for i in range(97, 123)]
# a = ord() #文字を数値に変換


if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

N = int(input())
ans = []

for s in input():
    idx = alp.index(s) 
    
    ans.append(alp[(idx+N)%26])
    
print(''.join(ans))

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = input()
    ans = [None] * len(S)
    for i in range(len(S)):
        c = S[i]
        x = (ord(c) - ord("A") + N) % 26 + ord("A")
        ans[i] = chr(x)
    print("".join(ans))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
character = list('abcdefghijklmnopqrstuvwxyz'.upper()) * 2

answer = []
for i in S:
    answer.append(character[character.index(i) + N])

print(''.join(answer))

Submission status: Accepted

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


def solve(N: int, S: str):
    alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    answer = ""
    for s in S:
        index = alpha.index(s)
        new_index = (index+N)%26
        answer+=alpha[new_index]
    print(answer)
    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:
# coding: utf-8
N = int(input())
S = input()
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = []
for i in range(len(S)):
    ans.append(letters[letters.index(S[i]) + N])
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(s)):
    x=ord(s[i])+n
    if x>ord("Z"):
        x-=ord("Z")
        x+=ord("A")-1
    s[i]=chr(x)
print("".join(s))

Submission status: Accepted

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

for c in s:
  print(chr((ord(c)-ord('A')+n)%26+ord('A')),end='')
print()

Submission status: Accepted

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