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:
# -*- coding: utf-8 -*-


def main():
    from string import ascii_uppercase

    n = int(input())
    s = input()
    alpha = ascii_uppercase
    ans = ''

    for si in s:
        for index, a in enumerate(alpha):
            if si == a:
                next_index = (index + n) % 26
                ans += alpha[next_index]

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
ans = ""
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)):
    for k in range(26):
        if S[i] == A[k]:
            if k+N < 26:
                ans += A[k+N]
            else:
                ans += A[k+N-26]
print(ans)

Submission status: Accepted

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

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

for c in s:
    nc = ord(c) + n
    if nc > 90:
        nc -= 26
    print(chr(nc), end="")

Submission status: Accepted

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

w_n = n % 26

print("".join([chr(65 + (ord(w) - 65 + w_n) % 26) for w in 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="")

Submission status: Accepted

Solution code:
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alphabet += alphabet
n = int(input())
s = list(input())
res = "".join([alphabet[alphabet.index(_) + n] for _ in s])
print(res)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
dic = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
s_ = ''
for c in s:
  i = dic.index(c)
  j = (i + n) % 26
  s_ += dic[j]
print(s_)

Submission status: Accepted

Solution code:
S='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
T=''
N=int(input())
U=input()
for i in U:
    T+=S[S.index(i)+N]
print(T)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
c=[chr(i) for i in range(65,65+26)]
#print(c)
n=int(input())
s=input()
for i in range(len(s)):
    if c.index(s[i])+n<26:
        print(c[c.index(s[i])+n],end="")
    else:
        print(c[c.index(s[i])+n-26],end="")
print()

Submission status: Accepted

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

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

print("".join(S))

Submission status: Accepted

Solution code:
N = int(input())
s = str(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)):
    ans+= l[(l.index(s[i])+N)%26]
print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import string
from sys import stdin
N = int(stdin.readline().rstrip())
S = list(stdin.readline().rstrip())
alpha = list(string.ascii_uppercase)
dic = {c:i for i, c in enumerate(alpha)}
ans = []
for c in S:
  idx = dic[c]+N
  if idx >= 26:
    idx -= 26
  ans.append(alpha[idx])
print(''.join(ans))

Submission status: Accepted

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

for i in range(len(l)):
    t = ord(l[i])+n
    if t<91:
        l[i] = chr(t)
    else:
        l[i] = chr(t-26)

print("".join(l))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

ans = ""
for i in range(len(S)):
    for j in range(len(ALPHA)):
        if S[i] == ALPHA[j]:
            ans += ALPHA[j+N]
            break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N = int(input()) % 26
S = input().rstrip()
ordA = ord("A")

res = ""
for s in S:
    res += chr(ordA + (ord(s) - ordA + N) % 26)

print(res)

Submission status: Accepted

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

ans = []

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

print("".join(ans))

Submission status: Accepted

Solution code:
import copy
import heapq
import math

def j(n):
    if n:print("Yes")
    else:print("No")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

n = ip()
s = input()

let = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(s)):
    p = let.index(s[i])
    p+=n
    print(let[p%26],end='')
print()

Submission status: Accepted

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

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

z_ascii = ord('Z')
S_ascii = map(ord, S)
S_ascii_new = []

for i in S_ascii:
    new = i+N
    S_ascii_new.append(new - 26 if new > z_ascii else new)

print(''.join(map(chr, S_ascii_new)))

Submission status: Accepted

Solution code:

n = int(input())
s = input()
m = len(s)

for i in range(m):
    print(chr((ord(s[i]) + n - 65) % 26 + 65), end="")
print("")

Submission status: Accepted

Solution code:
n=int(input())
s=input()
c=""
w=0
for i in s:
  w=ord(i)+n
  if w>ord("Z"):
    w=w-ord("Z")-1+ord("A")
  c+=chr(w)
  #print(chr(w))
print(c)

Submission status: Accepted

Solution code:
#alpha = [chr(i) for i in range(65, 65+26)]
N = int(input())
s = list(input())
ans = ""
for i in s:
	ans +=chr(((ord(i)-65)+N)%26+ 65)
	
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = input()
    ans = []
    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 S:
        for j in range(27):
            if i == A[j]:
                j += N
                if j >= 26:
                    j -= 26
                ans.append(A[j])
                break
    for i in range(len(ans)):
        print(ans[i], end="")
    print()


if __name__ == "__main__":
    main()

Submission status: Accepted

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

list_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']

list_ans =[]

for i in range(len(S)):
    if (list_abc.index(S[i])+N) > 25:
        list_ans.append(list_abc[list_abc.index(S[i])+N-26])
    else:
        list_ans.append(list_abc[list_abc.index(S[i])+N])

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

Submission status: Accepted

Solution code:
N=int(input())
S=input()
a=list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
for i in range(len(S)):
    print(a[a.index(S[i])+N],end="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
h = [0]*(10**5)

k = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

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

for j in range(len(s)):
  print(h[j],end="")

print(end="")

Submission status: Accepted

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

ans = ""
for string in S:
    if ord(string) + n > 90:
        ans += chr(ord(string) + n - 26)
    else:
        ans += chr(ord(string) + n)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=str(input())
al=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
t=''
for i in range(len(s)):
  x=(al.index(s[i])+n)%26
  t=t+al[x]
print(t)

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
P=list()
jia= N%26
for i in range(len(S)):
  xin= ord(S[i])+jia
  if xin > ord("Z"):
   xin-=26
  zimu=chr(xin)
  P+=zimu
p=''.join(P)
print(p)

Submission status: Accepted

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

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

l = ''.join(list)
print(l)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())

add = lambda c: ord(c) - ord("A") + N
cov = lambda c: chr(c+65)

S = list(input())
ans = ""
d = []
for i in range(len(S)):
    a = add(S[i])
    a = a % 26
    a = cov(a)
    ans += a
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
L = [chr(i) for i in range(65, 65+26)]
ans = ''
for i in range(len(S)):
    A = (L.index(S[i])+N) % 26
    ans += L[A]
print(ans)

Submission status: Accepted

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

abc ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in s:
    index =abc.index(i)
    new_index = index +n
    if(new_index> 25):
        new_index -= 26
    print(abc[new_index],end='')

Submission status: Accepted

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

def rot(s):
    return chr((ord(s) - 65 + N) % 26 + 65)

print("".join([rot(s) for s in S]))

Submission status: Accepted

Solution code:
import sys
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True  and False

def ddprint(x):
  if DBG:
    print(x)

a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n = inn()
n = n%26
b = a[n:] + a[:n]
ddprint(b)
s = input().strip()
for i in range(len(s)):
    for j in range(26):
        if s[i]==a[j]:
            printn(b[j])
            break
print("")

Submission status: Accepted

Solution code:
N = int(input())
S = input()
al = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(len(S)):
  x = al.index(S[i])
  y = (x+N)%26
  print(al[y],end='')

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}

res = ''
for s in S:
    idx = (dic[s]+N) % 26
    keys = [k for k, v in dic.items() if v == idx]
    res += keys[0]


print(res)

Submission status: Accepted

Solution code:
n=int(input())
hoge=list(input())
huga="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(len(hoge)):
  print(huga[huga.index(hoge[i])+n],end="")

Submission status: Accepted

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

ord_A = ord("A")

print("".join([chr((ord(s)-ord_A+N)%26+ord_A) for s in S]))

Submission status: Accepted

Solution code:
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)
a = int(input())
b = input()
result = caesar(b, a)
print(result)

Submission status: Accepted

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

A=""
for i in range(len(S)):
  a=((ord(S[i])-64+N)%26) if ((ord(S[i])-64+N)%26) else 26
  A+=chr(a+64)
  
print(A)

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(input())
S = input()
result = ""
alpha2num = lambda c: ord(c) - ord("A") + 1
num2alpha = lambda c: chr(c+64)

for s in S:
    sum = N+alpha2num(s)
    if sum > 26:
        result += num2alpha(sum - 26)
    else: result += num2alpha(sum)
print(result)

Submission status: Accepted

Solution code:
import subprocess
import os
import time


import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)

input = sys.stdin.readline


def main():
    N = int(input())
    S = list(input())[0: -1]

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

    print(''.join(S))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def solve(n, s):
    mapping = {chr(ord("A")+i): chr(ord("A")+(i+n)%26) for i in range(26)}
    return "".join(map(mapping.get, s))

n = int(input())
s = input()
print(solve(n, s))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
alpha=[chr(ord('A') + i) for i in range(26)]*2
M=[]

for j in range(len(S)):
    index=alpha.index(S[j])
    M.append(alpha[index+N])

print(''.join(M))

Submission status: Accepted

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

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

Submission status: Accepted

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

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(raw_input())
S = raw_input()
I = map(ord, S)
I_shifted = map(lambda x: x+N if x+N<91 else x+N-26, I)
print "".join(map(chr, I_shifted))

Submission status: Accepted

Solution code:
# coding: utf-8

alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

num = int(input())
str = input()
result = ""

for s in str:
  pos = alpha.find(s)
  pos = (pos+num)%len(alpha)
  result += alpha[pos]

print(result)

Submission status: Accepted

Solution code:
al='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
su=int(input())
moji=input()
ans=''
for i in moji:
  now=al.index(i)
  new=now+su
  if new>25:
    new-=26
  ans+=al[new]
print(ans)

Submission status: Accepted

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

for a in s:
  a = alphabet[(alphabet.index(a) + n) % 26]
  result.append(a)

st = "".join(result)
print(st)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = list(ord(x) - ord('A') for x in input())
    ans = list(chr((N+x)%26 + ord('A')) for x in S)

    print(''.join(ans))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

l=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
ans=[]
for st in s:
  ind=l.index(st)
  new_ind=ind+n
  if new_ind >25:
    new_ind-=26
  ans.append(l[new_ind])
print(*ans,sep="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

NUM = int(input())
STRING = input()
A_ASCII = ord('A')

result = ''
for s in STRING:
	result += chr(A_ASCII + (ord(s) + NUM - A_ASCII)%26)

print(result)

Submission status: Accepted

Solution code:
from collections import deque

def main():
    N = int(input())
    S = deque(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 = deque()

    while len(S)>0:
        s = S.popleft()
        i = A.index(s)+N
        ans.append(A[i%26])

    print(''.join(ans))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    ns = []
    for ch in s:
        ns.append(chr((ord(ch) - ord('A') + n) % 26 + ord('A')))
        
    print("".join(ns))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
#ord65-90
ans=[]
for i in range(len(s)):
    ord_num = ord(s[i])+n
    if 90 < ord_num:
        ord_num = ord_num-26
    tmp="".join(chr(ord_num))
    ans.append(tmp)
print(*ans,sep="")

Submission status: Accepted

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

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alph = ""
for i in range(26):
  alph += chr(65+i)
print(s.translate(str.maketrans(alph, alph[n:] + alph[:n])))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
order = list(S)
#print(order)
num = len(order)
T = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
aorder = list(T)
aorder[26:26] = aorder
#print(aorder)
ans = ''
for n in range(num):
    num2 = aorder.index(order[n])
    num3 = num2+N
    aordernum3 = aorder[num3]
    #print(aordernum3)
    ans += aordernum3  
print(ans)

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-90+64)
    else:
        S[i]=chr(ord(S[i])+N)
for j in range(len(S)):
    print(S[j],sep='',end='')

Submission status: Accepted

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

Submission status: Accepted

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

d = [chr(i) for i in range(65, 91)]

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

print("".join(map(str, ans)))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
for i in S:
    print(chr(((ord(i) + N) % 65) % 26 + 65), end="")
print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
n = int(input())
s = list(input())
alphabets = list(string.ascii_uppercase)

for i, v in enumerate(s):
    idx = alphabets.index(v) + n
    if idx >= 26:
        idx -= 26
    s[i] = alphabets[idx]

print(''.join(s))

Submission status: Accepted

Solution code:
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)
x = int(input())
y = str(input())
result = caesar(y, x)
print(result)

Submission status: Accepted

Solution code:
a=('ABCDEFGHIJKLMNOPQRSTUVWXYZ'*2)[int(input()):]
print(''.join([a[ord(c)-65] for c in input()]))

Submission status: Accepted

Solution code:
def add_alpha(char, add) :
    code = ord(char) + add
    if (code >= 91) :
        code -= 26
    return chr(code)


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

    out = ""
    for s in S:
        out += add_alpha(s,N)

    print(out)

main()

Submission status: Accepted

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

l = [chr(i) for i in range(65,65+26)]*2

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

ans = ''
for i in range(len(s)):
  j = alpha_dict[s[i]]
  ans += l[j+n]
  
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
def sc(n,l):
  al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  for i in range(26):
    if l == al[i]:
      return al[(i+n)%26]
for i in range(len(s)):
  print(sc(n,s[i]),end="")

Submission status: Accepted

Solution code:
l=[chr(ord('A') + i) for i in range(26)]
N=int(input())
S=input()
ans=""

for i in range(len(S)):
  ans += l[(l.index(S[i])+N)%26]
    
print(ans)

Submission status: Accepted

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

import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    s = input()
    base = ord('A')
    ans = ''
    for c in s:
        code = ord(c) - base
        replaced = chr((code + n) % 26 + base)
        ans += replaced
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i in range(len(s)):
    a = ord(s[i])+n
    #print(a)
    if a >=91:
        a = a-26
        ss += chr(a)
    else:
        ss += chr(a)
print(ss)

Submission status: Accepted

Solution code:
input_number = int(input())
input_str = input()
abc_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
abc_list = abc_list + abc_list
output_str = ""
for i in range(len(input_str)):
    output_str += abc_list[abc_list.index(input_str[i]) + input_number]
print(output_str)

Submission status: Accepted

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

ans = ''

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

temp = ''

for i in s:
    for j in range(n):
        if i != 'Z':
            i = chr(ord(i)+1)
        else:
            i = 'A'
    print(i, end='')

print()

Submission status: Accepted

Solution code:
import string
a = string.ascii_uppercase

x = int(input())
s = input()

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

Submission status: Accepted

Solution code:
num = int(input())
string = input()

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

return_string = ""
for alphabet in string:
	index = alpha2num(alphabet)

	new_num = index + num
	if new_num % 26 == 0:
		return_string += "Z"
	else:
		return_string += num2alpha(new_num % 26)

print(return_string)

Submission status: Accepted

Solution code:

a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def main(s,n,a):
    s = list(s)
    for i in range(len(s)):
        num = a.find(s[i])
        j = (num+n)%26
        s[i] = a[j]
    s = ''.join(s)
    return s

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

print(main(s,n,a))

Submission status: Accepted

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

for i in range(len(s)):
  for j in range(26):
    if s[i] == a[j]:
      s[i] = a[j + n]
      break

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

Submission status: Accepted

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

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

Submission status: Accepted

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

L = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
LL = [i for i in range(1, 26)]
ZZ = {}
YY = {}
for i, j in zip(L,LL) :
        ZZ[j] = i
        YY[i] = j
ZZ[0] = "Z"
YY["Z"] = 0

XX = [YY[i]+N for i in SS]
WW = [ZZ[i%26] for i in XX]
print("".join(WW))

Submission status: Accepted

Solution code:


alpha=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N=int(input())
S=input()
result=""
for i in S:
    index=alpha.index(i)
    result+=alpha[(index+N)%26]


print(result)

Submission status: Accepted

Solution code:
az = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2)

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

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

Submission status: Accepted

Solution code:
az = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2)

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

ans = ""
for s in S:
  ind = az.index(s)+N
  ans += az[ind]
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

tt = ord('A')
# print(ord('Z'))
n = inp()
s = input()
res = ''
for i in s:
    if ord(i) + n <= tt+25:
        tmp = chr(ord(i) + n)
    else:
        tmp = chr(ord(i) + n - 26)
    res += tmp
print(res)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
alphabet = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
n = int(input())
S = input()

ans = ""
for s in S:
    ans += alphabet[alphabet.index(s) + n]

print(ans)

Submission status: Accepted

Solution code:
import codecs
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:
az = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
dic = {}
for i, s in enumerate(az):
  dic[s] = i
N = int(input())
S = input()

az2 = az+az
ans = ""
for s in S:
  ind = dic[s]+N
  ans += az2[ind]
  
print(ans)

Submission status: Accepted

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

S = list(S)

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

print("".join(S))

Submission status: Accepted

Solution code:
def rotater(n):
  def rotate(c):
    return chr((ord(c)-ord('A')+n)%26+ord('A'))
  return rotate
print(''.join(map(rotater(int(input())), input())))

Submission status: Accepted

Solution code:
al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = int(input())
wli = list(input())
ali = []

for i in range(len(wli)):
    a = al.index(wli[i])
    ali.append(al[(n+a)%26])


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

Submission status: Accepted

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

ai = ord('A')

for i,s in enumerate(S):
    n = ord(s)
    nn= (n+N-ai)%26 + ai
    S[i]=chr(nn)

print(''.join(S))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
A = [chr(i) for i in range(65, 65+26)]*2

for x in S:
  print(A[int(ord(x)+N-65)],end='')

Submission status: Accepted

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

for C in S:
    out = ord(C) + N
    if out > ord('Z'):
        out -= 26
    print(chr(out),end='')
print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    ls='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    n=int(input())
    s=input()
    ans=''
    for t in s:
    	c=ls.index(t)
    	if n+c>25:
    	    n-=26
    	ans+=ls[n+c]
    print(ans)
resolve()

Submission status: Accepted

Solution code:
N=int(input())
a=[chr(ord('A')+i) for i in range(26)]
l={c:a[(a.index(c)+N)%26] for i,c in enumerate(a)}
ans=''
for c in input():
  ans+=l[c]
print(ans)

Submission status: Accepted

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

arr = [
       ["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 i in range(len(s)):
    idx = 0
    for j in range(len(arr)):
        if (s[i] == arr[j][0]):
            idx = arr[j][1]

    ans += arr[((idx + n) % 26)][0]
print(ans)