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:
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"]

def main():
  N = int(input())
  S = input()
  
  newS = ""
  for letter in S:
    num = order(letter, alphabet)
    new_order = (num + N) % 26
    newS += alphabet[new_order]
  print (newS)
    
def order(letter, alphabet):
  for i in range(len(alphabet)):
    if letter == alphabet[i]:
      return i

if __name__ == "__main__":
  main()

Submission status: Accepted

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

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"]
ans = ""
for i in range(0,len(S)):
  tmp = alphabet.index(S[i])
  tmp = (tmp + N) % 26
  #print(tmp)
  #print(alphabet[tmp])
  ans = ans + alphabet[tmp]

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Here your code !
N = int(input())
S =list(input())

slide = N % 26
ans = ""

for i in S:
    moji = (ord(i) + slide) % 91
    if moji < 65:
        moji += 65
    else:
        pass
    ans += chr(moji)
    
print(ans)

Submission status: Accepted

Solution code:

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

# A=65 Z=90
# ex 91 -> 65

for c in S:
    cd = ord(c) + N
    if cd > 90:
        cd -= 26
    print(chr(cd), end="")
print()

Submission status: Accepted

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


N = int(N)
Len = len(S)#文字数の長さ
LIST = list(S)#文字列を1文字ごとに分割する。

ANSWER = ""
#リストの中身をループ
for SS in LIST:
    NUNBER = ord(SS)#アスキーコードを出す組み込み関数:1文字しか対応していない
    NUNBER = NUNBER -65#アスキーコードからアルファベット順に変更
    AFFTER = NUNBER + N
    LAST  = AFFTER % 26
    LAST  = chr(LAST+65)#アスキーコードからアルファベットに戻す
    ANSWER = ANSWER + LAST
    
print(ANSWER)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input()) % 26
L=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']
NUM=range(0,len(ALP))
ALP_NO = dict(zip(ALP,NUM))
PLUS_ALP=ALP[N:] + ALP[:N]
ANS=''
for s in L:
  NUM = ALP_NO[s]
  ANS += PLUS_ALP[NUM]
print(ANS)

Submission status: Accepted

Solution code:

N = int(input())
s = input()

alef = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for letter in s:
    new_idx = (alef.index(letter) + N) % 26
    print(alef[new_idx], end="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(raw_input())
ss = raw_input()

abc = [x for x in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']

strs = []
for s in ss:
    idx = (abc.index(s) + n) % len(abc)
    x = abc[idx]
    strs.append(x)
print ''.join(strs)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
w = ""
for x in S:
    if abc.index(x) + 1 + N > 26:
        w += abc[abc.index(x) + N - 26]
    else:
        w += abc[abc.index(x) + N]
print(w)

Submission status: Accepted

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

codec = ['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 _s in s:
    result += codec[(codec.index(_s) + n) % 26]

print(result)

Submission status: Accepted

Solution code:
import string

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

up_s = string.ascii_uppercase

def caesar(s, shift_num):
    index = up_s.index(s)
    shifted_index = index + shift_num

    if shifted_index <= 25:
        return up_s[shifted_index]
    
    else:
        return up_s[shifted_index - 26]


print(''.join([caesar(s, N) for s in S]))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alphaList  =   ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
moji = ""
for str in s:
    index = alphaList.index(str)
    addNum = index + n
    if addNum >25:
        addNum = addNum - 26 
    moji = moji + alphaList[addNum]
print(moji)

Submission status: Accepted

Solution code:
num = int(input())
s = input()
res = ""
for x in s:
    loc = ord(x) + num
    res += chr(loc - 26 if loc > 90 else loc)
print(res)

Submission status: Accepted

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

import string
ss = string.ascii_uppercase

d = {}
for i, x in enumerate(ss):
    d[x] = (i + n) % len(ss)

ans = ''
for i in s:
    ans += ss[d[i]]    
print(ans)

Submission status: Accepted

Solution code:
dict = ['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']
new_str = ''
S = int(input())
strs = input()
 
for x in strs:
  new_idx = (dict.index(x)+S)%26
  new_str += str(dict[new_idx])
  
print(new_str)

Submission status: Accepted

Solution code:
n, s = [input() for i in range(2)]

l = [chr(i) for i in range(65,65+26)] + [chr(i) for i in range(65,65+26)]
#print(l)
#print(s)

t = ""
for i in s:
    #print(i)
    found = False
    j = 0
    while j<26 and found == False:
        if i == l[j]:
            t += l[j+int(n)]
            #print(t)
            found = True
        j += 1
print(t)

Submission status: Accepted

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

N = input() # 0~26
S = input() # 英大文字

ans = ""
for s in S:
    ans += l[(l.index(s)+int(N))%26]

print(ans)

Submission status: Accepted

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

import numpy as np

al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

S_index = np.array([al.index(i) for i in S])
T_index = S_index + N

T = [al[i%26] for i in T_index]

T = "".join(T)

print(T)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
a = [chr(i) for i in range(65, 65+26)]
result = ""
for s in S:
    result += a[(N+a.index(s))%26]
print(result)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    S = input()
    al=[chr(ord('A') + i) for i in range(26)]
    ans = ''
    for s in S:
        ans += al[(N+al.index(s))%26]
    print(ans)

Submission status: Accepted

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

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']
c_list=list(s)
next_s=list()

for c in c_list:
    for i in range(len(alph)):
        if c==alph[i]:
            if i+n>25:
                next_s.append(alph[i+n-26])
                break
            else:
                next_s.append(alph[i+n])
                break

mojiretu = ''

for x in next_s:
    mojiretu += x

print(mojiretu)

Submission status: Accepted

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

A="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
B={}
for i in range(len(A)):
    B[A[i]]=i
#print(B)
C=[]
for i in range(len(S)):
    C.append((B[S[i]]+int(N))%26)

#print(C)
D={}
for i in range(len(A)):
    D[i]=A[i]
#print(D)
E=[]
for i in range(len(C)):
    E.append(D[C[i]])



muramatu =''

for x in E:
    muramatu += x

print(muramatu)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
i = int(input())
s1 = input()
s = list(s1)
ans  = []

for k in range(len(s1)):
    a = ord(s1[k])
    #print(a)
    b = a + i
    #print(b)
    if b > 90:
        b = b - 26
    ans.append(chr(b))

print(''.join(ans))

Submission status: Accepted

Solution code:
KEY=int(input())
PLAIN = input()
enc = ""

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

print(enc)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
int_A = 65
letters = 26
nums = [ord(char) for char in S]
nums = [(num - int_A + N) % letters for num in nums ]
print(''.join([chr(num + int_A) for num in nums]))

Submission status: Accepted

Solution code:
alp = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
ALP = ['']*26
for i in range(26):
    ALP[i] = alp[i].upper()

N = int(input())
S = input()
T = ''
for i in range(len(S)):
    tmp = ALP.index(S[i])
    tmp = (tmp + N) % 26
    T += ALP[tmp]
print(T)

Submission status: Accepted

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

ans=''.join(a)
print(ans)

Submission status: Accepted

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

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

	
for i in range(0, len(s)):
	b = s[i]
	x = abc.index(b) + n
	while x > 25:
		x = x - 26	
	y = abc[x]
	s = list(s)
	s[i] = y
	s = ''.join(s)
print(s)

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
k = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(len(s)):
  s[i] = k[(k.index(s[i])+n)%len(k)]
s_change = "".join(s)
print(s_change)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
num = int(input())
base_str = input()
alphabets = ['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']
def replacer(letter, num):
    letter_index = alphabets.index(letter)
    return(alphabets[(letter_index+num)%26])
answer = []
for i in range(len(base_str)):
    answer.append(replacer(base_str[i], num))
answer = ''.join(answer)
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    ls = {i - 65: chr(i) for i in range(65, 91)}
    ans = []
    for i in range(len(s)):
        ans.append(ls[(ord(s[i]) - 65 + n) % 26])
    print("".join(ans))
    

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
n=int(input())
S=input()
A='ABCDEFGHIJKLMNOPQRSTUVWXYZ'*2
T=''
for s in S:
	T+=A[A.index(s)+n]
print(T)

Submission status: Accepted

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

Submission status: Accepted

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

for i in s:
  t = l.index(i)+n
  if t < 26:
    a.append(l[t])
  else:
    a.append(l[t-26])

print("".join(a))

Submission status: Accepted

Solution code:
def shiftText(plain_text, key):
    plain_text.lower
    encoded_text = ""
    for i in plain_text:
        char = ord(i)+key
        if (char > 90):
            char -= 26
            encoded_text += chr(char)
        else:
            encoded_text += chr(char)
    return encoded_text


key = int(input())
plain_text = input()

print(shiftText(plain_text, key))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)
# input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
import functools
import itertools
import math
INF = float('inf')
MOD = 10**9+7

AtoZ = [chr(i) for i in range(65,65+26)]
ItoC = defaultdict(str)
for i, x in enumerate(AtoZ):
    ItoC[x] = i

N = int(input())
S = input()
T = ''
for x in S:
    T += AtoZ[(ItoC[x]+N)%26]
print(T)

Submission status: Accepted

Solution code:
N = int(input())
S = list(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']
buf = ''
for i in range(len(S)) :
    buf += alpha[(alpha.index(S[i]) + N) % 26]
print(buf)

Submission status: Accepted

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


def Plus(x):
    x += N
    while(x>=91):
        x=64+(x%90)
    return x

print(''.join(list(map(chr, (list(map(Plus, S)))))))

Submission status: Accepted

Solution code:
N=int(input())
S=list(str(input()))
ans=''
az={}
az_dic={}
for i in range(65,65+26):
    az[chr(i)]=i-65
    az_dic[i-65]=chr(i)
    

for p in S:
    c = (az[p]+N) % 26
    ans += az_dic[c]


print(ans)

Submission status: Accepted

Solution code:
lst = [chr(i) for i in range(65, 65+26)]*2
N = int(input())
S = input()
for i in S:
    print(lst[lst.index(i)+N],end = "")

Submission status: Accepted

Solution code:
import codecs
n=int(input())
s=input()
d = {}
for c in (65, 97):
    for i in range(26):
        d[chr(i+c)] = chr((i+n) % 26 + c)

print("".join([d.get(c, c) for c in s]))

Submission status: Accepted

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

Submission status: Accepted

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

for i in S:
    l.append(i)

l = [ord(i) for i in l]     #ascii
newl = []
for i in l:
    if i + N >= 91:
        i = i - 26 + N
    else:
        i += N
    newl.append(i)

newl = [chr(i) for i in newl]
newl = ''.join(newl)
print(newl)

Submission status: Accepted

Solution code:
a=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")#26
b={0:'A',1:'B',2:'C',3:'D',4:'E',5:'F',6:'G',7:'H',8:'I',9:'J',10:'K',11:'L',12:'M',13:'N',14:'O',15:'P',16:'Q',17:'R',18:'S',19:'T',20:'U',21:'V',22:'W',23:'X',24:'Y',25:'Z'}
c={'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}
n=int(input())
s=input()
for i in range(len(s)):
    z=c[s[i]]
    z+=n
    if z>25:
        z-=26
    print(b[z],end="")
print()

Submission status: Accepted

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

Submission status: Accepted

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

Alphabet = 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z'
Alphabet = Alphabet.split(',')

for i in range(0, len(S)):
    for q in range(0, 26):
        if S[i] == Alphabet[q]:
            if q + N > 25:
                S[i] = Alphabet[q + N - 26]
            else:
                S[i] = Alphabet[q + N]
            break

S = ''.join(S)
print(S)

Submission status: Accepted

Solution code:
def add_N(S, N):
    code_Z = ord("Z")
    code_A = ord("A")
    code = ord(S) + N
    while code > code_Z:
        code = code - code_Z - 1 + code_A
    return code

N = int(input())
S = input()
length = len(S)

for i in range(0, length):
    print(chr(add_N(S[i], N)), end="")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import string
A = list(string.ascii_uppercase)
N = int(input())
S = input()
Output = ''
for i in range(len(S)):
    for j in range(len(A)):
        if A[j] == S[i]:
            Output += A[(j+N) % 26]
print(Output)

Submission status: Accepted

Solution code:
def main():
    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"]

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

    crypt = ""
    for c in list(s):
        crypt += alp[(alp.index(c) + n) % 26]

    print(crypt)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
l=[]
for i in range(65,(65+26)):
  l.append(chr(i))
n=int(input())
s=input()
ss=""
for i in s:
  x=ord(i)-64
  y=(x+n)%26
  ss+=l[y-1]
print(ss)

Submission status: Accepted

Solution code:
alps = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

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

ans = ''

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

print(ans)

Submission status: Accepted

Solution code:
alps = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
n = int(input())
s = input()

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

Submission status: Accepted

Solution code:
alps = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
n = int(input())
s = input()

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

Submission status: Accepted

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

zn = ord('Z')
ret = ''
for x in s:
  a = ord(x) + n
  if a > zn:
    a -= zn
    a += ord('A')-1
  ret += chr(a)

print(ret)

Submission status: Accepted

Solution code:

# ABC_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']
ABC_list = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

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

# 入力された文字列をリスト化
sList = list(s)

ans = ''

for i in range(len(sList)):
    # 1. 入力された文字列に相当するABC_listの要素番号をもらう
    ansnum = ABC_list.index(sList[i])
    # 2. ユーザから受けた数値を足しこむ
    ansnum = ansnum + n
    # はみ出た分は先頭に戻す
    if 25 < ansnum:
        ansnum = ansnum - 26
    # 3. 足しこまれた要素番号に対応する要素が答えになる
    temp = ABC_list[ansnum]
    # 4. リストに追加
    ans += temp

print(ans)

Submission status: Accepted

Solution code:
s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n= int(raw_input())
x = raw_input()
a = ord('A')
print ''.join([s[(ord(c) - a + n) % 26] for c in x])

Submission status: Accepted

Solution code:
n = int(raw_input())
s = raw_input()
uppercase = ['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 ch in s:
    ind = uppercase.index(ch)
    ind = (ind + n) % 26
    t += uppercase[ind]
print t

Submission status: Accepted

Solution code:
def solve(n: int, s: str) -> str:
    def inc(c: str, n: int) -> str:
        tbl = {
            0: 'A',
            1: 'B',
            2: 'C',
            3: 'D',
            4: 'E',
            5: 'F',
            6: 'G',
            7: 'H',
            8: 'I',
            9: 'J',
            10: 'K',
            11: 'L',
            12: 'M',
            13: 'N',
            14: 'O',
            15: 'P',
            16: 'Q',
            17: 'R',
            18: 'S',
            19: 'T',
            20: 'U',
            21: 'V',
            22: 'W',
            23: 'X',
            24: 'Y',
            25: 'Z',
        }
        rev_tbl = {v: k for k, v in tbl.items()}
        idx = (rev_tbl[c] + n) % len(tbl)
        return tbl[idx]

    return ''.join([inc(c, n) for c in s])


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

Submission status: Accepted

Solution code:
n = int(input())
s = 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=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 i in range(len(S)):
  for j in range(26):
    if  S[i]==A[j]:
      alpha=j
      alpha+=n
      alpha=alpha%26
      ans=ans+A[alpha]
print(ans)

Submission status: Accepted

Solution code:
num = int(input())
str = list(input())
alp = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
out=""
for i in range(len(str)):
	for l in range(len(alp)):
		if str[i]==alp[l]:
			out+=alp[(l+num)%26]
			break
print(out)

Submission status: Accepted

Solution code:
import sys
import math
from itertools import permutations
from itertools import combinations

#input = sys.stdin.readline
sys.setrecursionlimit(10**7)
N = int(input())
S = input()

l = []
for s in S:
    neww = chr(ord('A') + (( ord(s) - ord('A') + N )%26))
    l.append(neww)

print(''.join(l))

Submission status: Accepted

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

s = list(s)

l1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
l1 = list(l1)

l2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
l2 = list(l2)

s1 = [0]*len(s)
s2 = [0]*len(s)

for i in range(len(s)):
	s1[i] = l1.index(s[i])

for i in range(len(s)):
	s2[i] = l2[s1[i]+n] 

#リスト１つずつくっつけて文字列にする
ans = ''
for i in range(len(s2)):
	ans = ans + s2[i]

print(ans)

Submission status: Accepted

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

sb = ''
for char in charlist:
    charcode = ord(char)
    charcode += n
    if charcode >= 91:
        charcode -= 26
    sb += chr(charcode)
print(sb)

Submission status: Accepted

Solution code:
#ABC146-B ROT N
N = int(input())
S = input()

ans = []
for c in S:
    letter_offset = ord(c) - ord('A') + N # ord: int→ascii
    if letter_offset < 26:
        ans.append(chr(letter_offset + ord('A')))               # chr: ascii→int
    else:
        ans.append(chr(letter_offset - 26 + ord('A')))
print("".join(ans))

Submission status: Accepted

Solution code:
ar = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
a = int(input())
br = list(input())
ans = ""
for r in br:
  b = ar.index(r) + a
  if b >= 26:
    b -= 26
  ans += ar[b]
print(ans)

Submission status: Accepted

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

ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ALPHABET_LEN = len(ALPHABET)
prceed_val = n % ALPHABET_LEN

def trans(s):
    pos = ALPHABET.index(s)
#     print(s)
#     print(pos)
    newpos = pos + prceed_val


    if newpos > ALPHABET_LEN - 1:
        newpos = abs(ALPHABET_LEN - newpos)
#         print(minus_pos)
#         newpos = newpos + minus_pos

#     print(newpos)
    new_s = ALPHABET[newpos]
    return new_s

new_str= ''.join([trans(_s) for _s in s])

print(new_str)

Submission status: Accepted

Solution code:
A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = list(input())
list = list(A)
result_list = []
for i in range(len(S)):
    for ie in range(len(list)):
        if S[i] == list[ie]:
             result_list.append(list[(ie + N) % 26])
print(''.join(result_list))

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc146/tasks/abc146_b
A = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

A_LIST = list(A)

result = []

for i in range(len(S)):
    for wi in range(len(A_LIST)):
        # S[i] 文字は wi番目のアルファベット
        if S[i] == A_LIST[wi]:
            ss = (N + wi) % 26
            result.append(A_LIST[ss])

print("".join(result))

Submission status: Accepted

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

alphabet = ["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"]

output = []

for chara in S:
    a = alphabet.index(chara)
    b = alphabet[(a + N) % 26]
    output.append(b)

print(''.join(output))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
string = ""
engList = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
for i in s:
    string += engList[(engList.index(i) + n) % 26]
print(string)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = input()
    alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    print(S.translate(str.maketrans(alp, alp[N:] + alp[:N])))
    return


main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = list(input())
    ans = []
    a = ord("A")
    z = ord("Z")
    for s in S:
        if ord(s) + N <= z:
            ans.append(chr(ord(s) + N))
        else:
            ans.append(chr(ord(s) + N - z + a - 1))
    print("".join(ans))
    return


main()

Submission status: Accepted

Solution code:
N=input()
S=input()
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"]
out=[]
for i in S:
  idx=abc.index(i)
  idx=idx+int(N)%26
  if idx>25:
      idx-=26
  out.append(abc[idx])
out1=''.join(out)
print(out1)

Submission status: Accepted

Solution code:
_,l,a=int(input()),input(),'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
print(l.translate(str.maketrans(a,"".join(a[_:]+a[:_]))))

Submission status: Accepted

Solution code:
ls=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N=int(input())
S=input()
ans=[ls[(ls.index(S[i])+N)%26] for i in range(len(S))]
print("".join(ans))

Submission status: Accepted

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

A = ord('A')

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

print(T)

Submission status: Accepted

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

Submission status: Accepted

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

for i in S:
  n = ord(i)
  n = n + N
  if n > ord("Z"):
    n -= 26
  res += L[n - ord("A")]
  
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
n = int(input())
s = list(input())
#print(s)
ans = []

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

print(''.join(ans))

Submission status: Accepted

Solution code:
import string
N = int(input())
S = list(str(input()))
alpha = list(string.ascii_uppercase)
L = list()
for i in range(len(S)):
	L.append(alpha[(alpha.index(S[i])+N)%26])
print(''.join(L))

Submission status: Accepted

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

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

    ans = ""
    for moji in S:
        a = ord(moji) + N
        if a > ord("Z"):
            a -= ord("Z") - ord("A") + 1
        ans += chr(a)
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
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']
N = int(input())
S = input()
string = []
for i in S:
    a = alpha.index(i)
    if a+N>25:
        string.append(alpha[(a+N)%26])
    else:
        string.append(alpha[a+N])
s=''
for i in string:
    s = s+i
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
L = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
S = input()
res = ""
for i in S:
  n = ord(i)
  n = n + N
  if n > ord('Z'):
    n -= 26
  res += L[n - ord('A')]
print(res)

Submission status: Accepted

Solution code:
"""
#使用方法
print(ord("A")) #str型で入れたること
#>>65
print(chr(65)) #int型で入れたること
#>>A
"""
#ABC 146-D
n = int(input()) #n文字サイクルさせる
s = list(input()) #元の文字列(全て大文字)
list1 = []
for i in range(len(s)):
    number = (ord(s[i]) + n - ord("A")) %26 + ord("A")
    list1.append(chr(number))

print("".join(list1))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
def next_chr(chara):
    if chara == "Z":
        return "A"
    else:
        return chr(ord(chara)+1)

def next_n(chara, n):
    for i in range(n):
        chara = next_chr(chara)
    return chara
for i in s:
    print(next_n(i, n), end = "")

Submission status: Accepted

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

list_S = list(S)

for i in range(len(list_S)):
    list_S[i] = chr( ord(list_S[i]) + N )

    if ord(list_S[i]) > ord('Z'):
        list_S[i] = chr( ord('A') + ( ord(list_S[i])- ord('Z') ) -1 )

print("".join(list_S))

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
S = list(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", 
      "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"]
tmp = ""
for i in range(len(S)):
    tmp += al[al.index(S[i])+N]
print(tmp)

Submission status: Accepted

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

ans = []

for s in S:
    if ord(s) + N > ord('Z'):
        ans.append(chr(ord(s) + N - 26))
    else:
        ans.append(chr(ord(s) + N))

print(''.join(ans))

Submission status: Accepted

Solution code:
N=input()
s=input()
#ABCXYZ
L=[]
L.append('A')
L.append('B')
L.append('C')
L.append('D')
L.append('E')
L.append('F')
L.append('G')
L.append('H')
L.append('I')
L.append('J')
L.append('K')
L.append('L')
L.append('M')
L.append('N')
L.append('O')
L.append('P')
L.append('Q')
L.append('R')
L.append('S')
L.append('T')
L.append('U')
L.append('V')
L.append('W')
L.append('X')
L.append('Y')
L.append('Z')

answer=[]
for l in s:
  num=L.index(l)
  #print(type(num))
  #print(type(int(N)))
  newN=L.index(l)+int(N)
  n=newN%26
  answer.extend(L[n])  
  
answer="".join(answer)
print(answer)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
S = [x - ord('A') for x in read().rstrip()]
S = [(x + N) % 26 for x in S]

answer =  ''.join(chr(x + ord('A')) for x in S)
print(answer)

Submission status: Accepted

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

s=[]
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
a+=a
for c in S:
	s+=a[a.find(c)+N]

print(*s,sep='')