Problem:


Score : 200 points

Problem Statement

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

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

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

Constraints

0 \leq N \leq 26

1 \leq |S| \leq 10^4

S consists of uppercase English letters.

Input

Input is given from Standard Input in the following format:

N
S

Output

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

Sample Input 1

2
ABCXYZ

Sample Output 1

CDEZAB

Note that A follows Z.

Sample Input 2

0
ABCXYZ

Sample Output 2

ABCXYZ

Sample Input 3

13
ABCDEFGHIJKLMNOPQRSTUVWXYZ

Sample Output 3

NOPQRSTUVWXYZABCDEFGHIJKLM



Sample input:
2
ABCXYZ


Sample output:
CDEZAB

Submission status: Accepted

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

num2alpha = lambda c: chr(c+64)
#print(num2aipha(3))

alpha2num = lambda c: ord(c) - ord("A") + 1
#print(alpha2num("Y"))

#英文字を数字に変換
for i in range(len(S)):
    S[i] = alpha2num(S[i]) 

#数字を指示された分加算
def calc(n):
    return n + N 

S2 = list(map(calc, S))
#print(S2)

#数字から英文字に戻す
for j in range(len(S)):
    S2[j] = S2[j] % 26
    if S2[j] == 0:
        S2[j] = 26
    S2[j] = num2alpha(S2[j])
#print(S2)

#リストからつなげた文字列に変換
S3 = "".join(S2)
print(S3)

Submission status: Accepted

Solution code:
from sys import stdin
num = int(stdin.readline().rstrip())
txt = stdin.readline().rstrip()
sum = lambda x: chr((ord(x)-ord('A')+num)%26+ord('A'))
print(''.join(map(sum, txt)))

Submission status: Accepted

Solution code:
AL = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
 
N = int(input())
 
S = input()
A = []
 
for i in range(len(S)):
  B = AL.index(S[i])+N
  if B >= 26:
    B = B -26
  A.append(AL[B])
  
for j in range(len(S)):
  print(A[j], end='')

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
base_list = np.array(['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'])
dict_list = []
dict_list.append(base_list)
for i in range(26):
    tmp_char = dict_list[i][0]
    tmp_list = dict_list[i][1:]
    tmp_list = np.append(tmp_list,tmp_char)
    dict_list.append(tmp_list)

def print_ans(N, sr):
    """Test Case
    >>> print_ans(2, ['A', 'B', 'C', 'X', 'Y', 'Z'])
    CDEZAB
    >>> print_ans(0, ['A', 'B', 'C','X', 'Y', 'Z'])
    ABCXYZ
    """
    idx_list = []
    for s in sr:
        tmp = np.where(base_list == s)[0]
        idx_list.append(int(tmp))
    ans = ''.join(dict_list[N][idx_list])
    print(ans)

if __name__ == '__main__':
    N = int(input().rstrip())
    tmp_s= input().rstrip()
    sr = []
    for s in tmp_s:
        sr.append(s)
    print_ans(N, sr)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
l=s.lower()
ans=""
for i in list(l):
  asd=ord(i)
  num=asd-97
  num=(num+n)%26
  asd=num+97
  ans+=chr(asd)
print(ans.upper())

Submission status: Accepted

Solution code:
move_num = int(input())
input_char_str = input()

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

ans_char = ""
move_number = move_num
for input_char in input_char_str:
    if (char_list.index(input_char)+move_number) < len(char_list):
        ans_char += char_list[char_list.index(input_char)+move_number]
    else:
        char_index = (char_list.index(input_char)+move_number) - len(char_list)
        ans_char += char_list[char_index]
        
print(ans_char)

Submission status: Accepted

Solution code:
#[chr(i) for i in range(65, 65+26)]
number=int(input())
moji=input()
moji_list=list(moji) #1文字ずつリストにする

#print(moji_list)
#ord関数を使って数値化する。

moji_number=[]
moji_number=[ord(i) for i in moji_list]
#print(moji_number)
moji_number_plus=[0 for i in moji_list]

for i in range(len(moji_number)):
    if moji_number[i]+number>90:
        moji_number_plus[i]=moji_number[i]+number-26
        #print("if今のiは"+str(i)+"です")
    else:
        #print("else今のiは"+str(i)+"です")
        #print(number)
        moji_number_plus[i]=moji_number[i]+number


#print(moji_number_plus)
result=[]
result=[chr(i) for i in moji_number_plus]
result2=''.join(result)
print(result2)

Submission status: Accepted

Solution code:
SHIFT_COUNT = int(input())
encryptionStr = input()
result = ""
excludeStr = "{}_"

for c in encryptionStr :
    # 除外する文字列ならば変換せず、そのままにする
    if excludeStr.find(c) != -1 :
        result = result + c
        continue

    # 暗号化する処理
    if ord('a') <= ord(c) <= ord('z') :
        result = result + chr(abs(((ord(c) + SHIFT_COUNT - ord('a')) % 26)) + ord('a'))
    else :
        result = result + chr(abs(((ord(c) + SHIFT_COUNT - ord('A')) % 26)) + ord('A'))

print (result)

Submission status: Accepted

Solution code:
a = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
b = ''
e = int(input())

for c in list(input()):
  d = a.index(c)
  if d > 25 - e:
    d = d - (26)
    b += a[(d+e)]
  else:
    b += a[(d+e)]

print(b)

Submission status: Accepted

Solution code:
Alpha = [chr(i) for i in range(65, 91)]
N = int(input())
S = list(input())
New_S = []
for i in range(len(S)):
    p = Alpha.index(S[i]) + N
    if p >= 26:
        p = p - 26
    New_S.append(Alpha[p])

print(''.join(New_S))

Submission status: Accepted

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

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

print("".join(A))

Submission status: Accepted

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

ab = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

dict = {}
for i, ab_ in enumerate(ab[:26]):
    dict[ab_] = i
ab2 = ab[n:n+26]
new = ''
for s_ in s:
    new += ab2[dict[s_]]
print(new)

Submission status: Accepted

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

abc = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") 
ans = []

for i in range(len(S)):
    index = abc.index(S[i])
    if index + N < 26:
        ans.append(abc[index + N])
    else:
        ans.append(abc[index + N - 26])
print("".join(ans))

Submission status: Accepted

Solution code:
n=int(input())
s=input().strip()
a='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
aa = dict()
for i, c in enumerate(a):
    aa[c] = i
def f(c):
    return a[(aa[c] + n)%26]

r = ''
for c in s:
    r += f(c)
print(r)

Submission status: Accepted

Solution code:

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

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

li = []
sli=list(S)
for i in range(len(S)):
    if(alpha2num(sli[i])+N<=26):
        li.append(alpha2num(sli[i])+N)
    if(alpha2num(sli[i])+N>26):
        li.append(alpha2num(sli[i])+N-26)

ans= []
for i in li:
    ans.append(num2alpha(i))

ansstr= ''
for x in ans:
    ansstr += x
print(ansstr)

Submission status: Accepted

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

mojiretsu = []
for moji in S:
    ord_moji = ord(moji) + N
    # print("ord(moji):", ord(moji))

    # 65, 90
    # 90を超えるものは、65に90を超えた分を足していく。
    # ord_moji = ord(moji)
    while ord_moji > 90:
        ord_moji = 64 + (ord_moji - 90)
    
    mojiretsu.append(chr(ord_moji))

ans = ''.join(mojiretsu)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
l = list(s)
result = ''.join(map(lambda x : chr(((ord(x)+n) - 65) % 26 + 65), l))
print(result)

Submission status: Accepted

Solution code:
from string import ascii_uppercase

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


def gen(n):
    ret = {k: k for k in ascii_uppercase}
    for i, c in enumerate(ascii_uppercase):
        ret[c] = ascii_uppercase[(i + n) % len(ascii_uppercase)]
    return ret


table = gen(n)
ans = ""
for c in s:
    ans += table[c]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
ans =''
rot_list = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(len(s)):
    ans += rot_list[(rot_list.index(s[i])+n)%26]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s =list(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)):
    if l.index(s[i])+n>25:
        ans.append(l[l.index(s[i])+n-26])
    else:
        ans.append(l[l.index(s[i])+n])

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

Submission status: Accepted

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

Answer = ''
for i in range(len(S)):
  raworder = Alphabet.find(S[i])
  order = (raworder + N) % 26
  Answer += Alphabet[order]

print(Answer)

Submission status: Accepted

Solution code:
N = int(input())
strlist = list(str(input()))
for a in strlist:
  anum = ord(a)
  rot = anum + N if anum + N <= ord("Z") else anum + N - 26
  print(chr(rot), end="")

Submission status: Accepted

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

print(*a, sep='')

Submission status: Accepted

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

alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

for i in range(len(S)):
    for j in range(26):
        if S[i] == alphabets[j]:
            t = j
            if t + N <= 25:
                ans_lis.append(alphabets[t + N])
            else:
                ans_lis.append(alphabets[t + N - 26])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
from collections import deque

deq = deque(string.ascii_uppercase)
lis = list(string.ascii_uppercase)

#INPUTS
N = int(input())
str_ = list(input())
deq.rotate(-N) 

mem = list()
for s in str_:
  i = lis.index(s)
  mem.append(deq[i])
  
print("".join(mem))

Submission status: Accepted

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

Alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
d = 0
k = ""

for i in range(len(S)):
    d = N + int(Alpha.find(S[i]))

    while(d >= len(Alpha)):
        d = d - len(Alpha)

    k = k + Alpha[d]

print(k)

Submission status: Accepted

Solution code:
a=int(input())
s=list(input())
t=[]
list=[chr(i) for i in range(65, 65+26)]
for i in s:
  t.append(list.index(i))
u=[i+a for i in t]
u=[i-26 if i>=26 else i for i in u]
b=[]
for i in u :
  b.append(list[i])
k=""
for s in b:
  k+=s
print(k)

Submission status: Accepted

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

alfa=list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")

for i in s:
  for j in range(26):
    if i==alfa[j]:
      ans+=alfa[j+n]
print(ans)

Submission status: Accepted

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

#Noneが0番目、Zが26番目の要素になる。
Alphabet = ["None","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 char in S:
    char_position = Alphabet.index(char)
    added_num = char_position + N
    if added_num > 26:
        added_num = added_num % 26
    if added_num == 0:
        added_num = 26
    changed_char = Alphabet[added_num]
    ans = ans + changed_char

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

letters=['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']
play=''
for j in range(len(S)):
    for i, let in enumerate(letters):
        if S[j]==let and i+N < len(letters):
            play+=letters[i+N]
        elif S[j]==let and i+N >= len(letters):
            play+=letters[N-len(letters)+i]
print(play)

Submission status: Accepted

Solution code:
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alphabet_list = [ch for ch in alphabet]

def get_alphabet_num(chr):
    global alphabet
    global alphabet_list
    num = 0
    for i in range(len(alphabet)):
        if chr == alphabet_list[i]:
            num = i
            break
    return num

N = int(input())
input_str = input()

list = [''] * len(input_str)

for i in range(len(input_str)):
    input_num = get_alphabet_num(input_str[i]) + N
    if input_num > 25:
        input_num -= 26
    list[i] = alphabet_list[input_num]
    input_num = 0

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

Submission status: Accepted

Solution code:
import numpy as np
s = [input() for i in range(2)]
N = int(s[0])
S = list(s[1])
eng = list('ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ')
idx = np.array([eng.index(S[i]) for i in range(len(S))])
N_l = np.array([N]*len(S))
new_idx = idx + N_l
ans = [eng[i] for i in new_idx]
fin_ans = ''
for x in ans:
    fin_ans += x
print(fin_ans)

Submission status: Accepted

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

# 秘密鍵
KEY = N

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

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

print(enc)
#シーザー暗号
#https://qiita.com/Naoto9282/items/0c7dd06b0b6cd574d7d3

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
AZ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for c in S:
    print(AZ[(AZ.index(c)+N) % len(AZ)], end="")

Submission status: Accepted

Solution code:
n = int(input().strip())
s = input().strip()
ansarray = []
for i in range(len(s)):
    if s[i] == 'A':
        snum = 1
    if s[i] == 'B':
        snum = 2
    if s[i] == 'C':
        snum = 3
    if s[i] == 'D':
        snum = 4
    if s[i] == 'E':
        snum = 5
    if s[i] == 'F':
        snum = 6
    if s[i] == 'G':
        snum = 7
    if s[i] == 'H':
        snum = 8
    if s[i] == 'I':
        snum = 9
    if s[i] == 'J':
        snum = 10
    if s[i] == 'K':
        snum = 11
    if s[i] == 'L':
        snum = 12
    if s[i] == 'M':
        snum = 13
    if s[i] == 'N':
        snum = 14
    if s[i] == 'O':
        snum = 15
    if s[i] == 'P':
        snum = 16
    if s[i] == 'Q':
        snum = 17
    if s[i] == 'R':
        snum = 18
    if s[i] == 'S':
        snum = 19
    if s[i] == 'T':
        snum = 20
    if s[i] == 'U':
        snum = 21
    if s[i] == 'V':
        snum = 22
    if s[i] == 'W':
        snum = 23
    if s[i] == 'X':
        snum = 24
    if s[i] == 'Y':
        snum = 25
    if s[i] == 'Z':
        snum = 26
    if snum + n <= 26:
        ansnum = snum + n
    else:
        ansnum = (snum + n) - 26
    if ansnum == 1:
        ansarray.append('A')
    if ansnum == 2:
        ansarray.append('B')
    if ansnum == 3:
        ansarray.append('C')
    if ansnum == 4:
        ansarray.append('D')
    if ansnum == 5:
        ansarray.append('E')
    if ansnum == 6:
        ansarray.append('F')
    if ansnum == 7:
        ansarray.append('G')
    if ansnum == 8:
        ansarray.append('H')
    if ansnum == 9:
        ansarray.append('I')
    if ansnum == 10:
        ansarray.append('J')
    if ansnum == 11:
        ansarray.append('K')
    if ansnum == 12:
        ansarray.append('L')
    if ansnum == 13:
        ansarray.append('M')
    if ansnum == 14:
        ansarray.append('N')
    if ansnum == 15:
        ansarray.append('O')
    if ansnum == 16:
        ansarray.append('P')
    if ansnum == 17:
        ansarray.append('Q')
    if ansnum == 18:
        ansarray.append('R')
    if ansnum == 19:
        ansarray.append('S')
    if ansnum == 20:
        ansarray.append('T')
    if ansnum == 21:
        ansarray.append('U')
    if ansnum == 22:
        ansarray.append('V')
    if ansnum == 23:
        ansarray.append('W')
    if ansnum == 24:
        ansarray.append('X')
    if ansnum == 25:
        ansarray.append('Y')
    if ansnum == 26:
        ansarray.append('Z')
ans = ''
for j in range(len(s)):
    ans = ans + ansarray[j]
print(ans)

Submission status: Accepted

Solution code:
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7


def main():
    n = int(input())
    s = list(input())
    # l = []
    # for i in range(26):
    #     l.append(ord("A") + i)
    # print(l)
    for i in range(len(s)):
        s[i] = chr(ord("A") + (ord(s[i]) - ord("A") + n)%26)
    print("".join(map(str,s)))

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

    # e = [[] for i in range(n+1)]
    # for i in range(n-1):
    #     a, b = ab[i]
    #     e[a].append(b)

    # d = defaultdict(int)
    # for i in range(n-1):
    #     a, b = ab[i]
    #     d[a] += 1
    #     d[b] += 1
    # ans = 0
    # for i in d.keys():
    #     ans = max(ans, d[i])
    # print(ans)
    # # print(d.values())
    # # ansl = [0 for i in range(n + 1)]
    # # dd = defaultdict(int)
    # # for i in range(n - 1):
    # #     a, b = ab[i]
    # #     c = max(dd[a], dd[b]) + 1
    # #     ansl[i] = c
    # #     dd[a] += c + 1
    # #    dd[b]+=c + 1
        

        
    # ansl = [0 for i in range(n+1)]
    # col = [-1 for i in range(n+1)]
    # def f(v, c):
    #     col[v] = 1
    #     t = 1
    #     for i in e[v]:
    #         if col[i] == -1:
    #             if t == c:
    #                 t+=1
    #             ansl[i] = t
    #             f(i, t)
    #             t+=1
    # f(1,0)
    # #print(*ansl)
    # for i in range(2,len(ansl)):
    #     print(ansl[i])



    

    

    


if __name__ == '__main__':
    main()

Submission status: Accepted

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

answer = []
newN = N % 26
alp = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
for i in S:
  for num, j in enumerate(alp):
    if i == j:
      k = num + newN
      k = k % 26
      answer.append(alp[k])
      break
answer2 = ''.join(answer)
print(answer2)

Submission status: Accepted

Solution code:
n = int(input())
s = list(map(ord,list(input())))
s = list(map(lambda x: ((x+n-65)%26+65), s))

ans = ''
for ss in s:
  ans += chr(ss)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
ns=""
for c in s:
	if ord(c)+n<=ord("Z"):
		ns+=chr(ord(c)+n)
	else:
		ns+=chr(ord(c)+n-ord("Z")+ord("A")-1)
print(ns)

Submission status: Accepted

Solution code:
# 整数の入力
a = int(input())

# 文字列の入力
S = str(input())

chr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
SS = []

for k in range(len(S)):
    for j in range(len(chr)):
        if S[k] == chr[j]:
            if (j+a) >= 25:
                SS += chr[j+a-26]
            else:
                SS += chr[j+a]

SS = ''.join(SS)

print(SS)

Submission status: Accepted

Solution code:
n = int(input())						# 5
s = input()		# 文字列の入力  abcdefg...


S = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

ans=""

for c in s:
	#print(c)
	i = ord(c) + n
	if i>90: i-=26
	
	ans = ans + chr(i)

print(ans)

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"]
S_2=[]
for s in S:
    if alphabet.index(s)+N <= len(alphabet)-1:
        index = alphabet.index(s)+N
        S_2.append(alphabet[index])
    else:
        index = alphabet.index(s)+N - len(alphabet)
        S_2.append(alphabet[index])
print(''.join(S_2))

Submission status: Accepted

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

ans = []

# いったんリストにする
str_list = list(s)

for j in range(len(str_list)):
  temp = ord(str_list[j])+n
  if temp >= 91:
    temp = temp-26
  ans.append(chr(temp))

# またリストから文字列へ戻す
str_changed = "".join(ans)
print(str_changed)

Submission status: Accepted

Solution code:
def main():
    alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    n = len(alpha)
    s2i = {}
    i2s = {}
    for i, s in enumerate(alpha):
        s2i[s] = i
        i2s[i] = s

    N = int(input())
    S = input()
    w = ''.join([i2s[(s2i[s] + N) % n] for s in S])
    print(w)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
temp = 0
ans = ""
for i in input():
    temp = ord(i)
    if temp + N >= 65 + 26:
        temp = temp - 26
    ans += chr(temp + N)
print(ans)

Submission status: Accepted

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

def slide_chr(s,n):
    return chr(((ord(s)+n)-65)%26 + 65)

s = [slide_chr(i,n) for i in s]
print("".join(s))

Submission status: Accepted

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

list = [chr(ord('A') + i) for i in range(26)]

ans = []
for i in s:
    if (ord(i)-65+n) > 25:
        ans.append(list[ord(i)-65 -25 + n-1])
    else:
        ans.append(list[ord(i)-65 +n])

print("".join(ans))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
a=list(S)
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","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"]
SS2=[]
for i in range(len(a)):
    x=alpha.index(a[i])
    SS2.append(x)
 
for j in range(len(SS2)):
    SS2[j]+=N
 
SS3=[]
for k in range(len(SS2)):
    y=alpha[SS2[k]]
    SS3.append(y)
 
moji="".join(SS3)
print(moji)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
str=input()
ordnum=0
ans=""
for i in str:
  ordnum=ord(i)+N
  if (ordnum>=91):
    ordnum=ordnum-26
  ans=ans+chr(ordnum)
print(ans)

Submission status: Accepted

Solution code:
n=input()

s=input()
s=s.lower()

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"]
length=len(s)
export=""
for i in range(length):
    num=list.index(s[i])
    num=(num+int(n))%26
    export+=list[num]
    
export=export.upper()
print(export)

Submission status: Accepted

Solution code:
n=int(input())
s=str(input())
a=""
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","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 car in s:
  for alp in l:
    if car == alp:
      a = a + l[l.index(alp)+n]

print(a[0::2])

Submission status: Accepted

Solution code:
n=int(input())
l=[]
pos={}
for i in range(ord('A'),ord('Z')+1):
  l.append(chr(i))
  pos[chr(i)]=len(l)-1
for i in input():
  print(l[(pos[i]+n)%26],end="")

Submission status: Accepted

Solution code:
import string

offset = int(input())

H   = {}
rH  = {}

n = len(string.ascii_uppercase)
for i, c in enumerate(string.ascii_uppercase):
    H[c] = i
    rH[(i-offset+n) % n] = c

st = input().strip()
for c in st:
    print(rH[H[c]], end = '')

Submission status: Accepted

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

ls_a = [0]*len(ls_s)

for i in range(len(ls_s)):
    num_si = ord(ls_s[i])
    if num_si + n <= 90:
        num_ai = num_si + n
    else:
        num_ai = 64 + (num_si + n) % 90
    ls_a[i] = chr(num_ai)

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

Submission status: Accepted

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

N=int(input())
S=input()
S2=[]

for s in list(S):
    for i in range(26):
        if alf[i]==s:
            s=alf[i+N]
            S2.append(s)
            s="a"

tmp=""
for i in S2:
    tmp+=i
print(tmp)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
a=0
m=""
c=[chr(i) for i in range(65,65+26)]
for x in s:
  t=ord(x)-65
  a=n+t
  if 25<a:
    a-=26
  m+=c[a]
print(m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S =input()
M =len(S)
S = list(S)
def f(a):
    if a == "A":
        a = "B"
    elif a == "B":
        a = "C"
    elif a == "C":
        a = "D"
    elif a == "D":
        a = "E"
    elif a == "E":
        a = "F"
    elif a == "F":
        a = "G"
    elif a == "G":
        a = "H"
    elif a == "H":
        a = "I"
    elif a == "I":
        a = "J"
    elif a == "J":
        a = "K"
    elif a == "K":
        a = "L"
    elif a == "L":
        a = "M"
    elif a == "M":
        a = "N"
    elif a == "N":
        a = "O"
    elif a == "O":
        a = "P"
    elif a == "P":
        a = "Q"
    elif a == "Q":
        a = "R"
    elif a == "R":
        a = "S"
    elif a == "S":
        a = "T"
    elif a == "T":
        a = "U"
    elif a == "U":
        a = "V"
    elif a == "V":
        a = "W"
    elif a == "W":
        a = "X"
    elif a == "X":
        a = "Y"
    elif a == "Y":
        a = "Z"
    elif a == "Z":
        a = "A"
    return a

for i in range(M):
    if N != 0:
        for j in range(N):
            S[i] = f(S[i])

print(''.join(S))

Submission status: Accepted

Solution code:

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

alphabets = []
for alphabet in range(ord('A'), ord('Z')+1):
    alphabets.append(chr(alphabet))


ans_list = []
for i in S:
    num = alphabets.index(i)
    position = num + N
    if position > 25: 
        position -= 26 
    ans_list.append(alphabets[position])

for i in ans_list:
    print(i, end='')

Submission status: Accepted

Solution code:
def change_str(moto_str):
    global Nnew
    global str_list
    global change_list

    for i in range(len(change_list)):
       if change_list[i] == moto_str:
            num = i+Nnew
            if num > 25:
                num = num - 26
    return change_list[num]

Nnew = int(input())
str = input()
str_list = list(str)
change_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"]

for i in range(len(str_list)):
    str_list[i] = change_str(str_list[i])


print(*str_list,sep='')

Submission status: Accepted

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

al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
step = []
for i in al:
    step.append(i)
    

string = []
for i in S:
    for j in range(26):
        if (i == step[j]): 
            if ((j+N)<26) : string.append(step[j+N])
            else : string.append(step[j+N-26])
            
Ans = ''.join(string)
print(Ans)

Submission status: Accepted

Solution code:
al=[chr(ord('A') + i) for i in range(26)] * 2
N = int(input())
S = str(input())
s_list = []
for s in S:
    s = al[ord(s) - 65 + N]
    s_list.append(s)
s_list
print("".join(s_list))

Submission status: Accepted

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

a1 = [(ord(i) + N) for i in S]
a2 = [chr(i-26) if i>90 else chr(i) for i in a1]
a3 = [str(a) for a in a2]
L="".join(a3)
print(L)

Submission status: Accepted

Solution code:
import string


def get_input():

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

    return N, S


def convert(S, N):

    count = string.ascii_uppercase.index(S) + N
    count = count % 26

    return string.ascii_uppercase[count]


def main():

    N, S = get_input()

    res = []
    for s in S:
        res.append(convert(s, N))

    print(''.join(res))


main()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
s_list = list(S)
al_list = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
str_list = []
for w in s_list:
    str_list.append(al_list[(al_list.index(w) + N) % 26])
print(''.join(str_list))

Submission status: Accepted

Solution code:
import sys
input_num = int(input())
input_str = str(input())

for i in input_str:
    chr_ord = ord(i) + input_num
    if chr_ord > 90:
        chr_ord -= 26
    print(chr(chr_ord),end="")

Submission status: Accepted

Solution code:
##B
n = int(input())
s = input()
az = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
answer = ""
for i in range(len(s)):
    for j in range(int(len(az)/2)):
        if s[i] == az[j]:
            answer += az[j+n]
print(answer)

Submission status: Accepted

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

L = list(S)

O = []

for i in range(len(L)):
  O.append(ord(L[i]))
#print(O)
for i in range(len(L)):
  O[i] = O[i] + N
  if O[i] > 90:
    a = O[i] - 90
    O[i] = 64 + a

R = []

for i in range(len(L)):
  R.append(chr(O[i]))

for i in range(len(L)-1):
  R[0] = R[0] + R[i+1]


#print(N)
#print(S)
#print(L)
#print(O)
#print(R)
print(R[0])

Submission status: Accepted

Solution code:
input = [input() for i in range(2)]
N = int(input[0])
S = input[1]

alpha_dict = {}
alpha_dict_rev = {}
for i,c in enumerate(range(ord('A'),ord('Z')+1)):
    alpha_dict[chr(c)] = i
    alpha_dict_rev[i] = chr(c)
    
S_digit = ''
for i in range(0,len(S)):
    S_digit += str(alpha_dict_rev[(alpha_dict[S[i]]+N)%26])

print(S_digit)

Submission status: Accepted

Solution code:
def change_code(moji, num):
  new_code = ord(moji) + num
  if new_code > 90:
    new_code -= 26
  return chr(new_code)

n = int(input())
s = input()
s_num = []

for _ in range(len(s)):
  s_num.append(n)

change_s = map(change_code, s, s_num)
print(''.join(list(change_s)))

Submission status: Accepted

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

    L=[]
    Slen = len(S)
    for i in range(Slen):
        tmp = ord(S[i]) + N
        if tmp <= 90:
            L.append(chr(tmp))
        if tmp > 90:
            tmp = tmp - 26
            L.append(chr(tmp))
    ans = ''.join(L)
    print(ans)
resolve()

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']
Y = []

for s in S:
    ix = ( A.index(s) + N ) % 26 
    Y.append(A[ix])

print(''.join(Y))

Submission status: Accepted

Solution code:
a=int(input())
alp=input()
x=""
for i in range(len(alp)):
    f=(a+ord(alp[i])-65)%26+65
    x+=chr(f)
print(x)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
S_list = list(S)
AR = [chr(ord("A") + i) for i in range(26)]

for i in range(len(S_list)):
    for j in range(26):
        if str(S_list[i]) == str(AR[j]):
            if j + N >= 26:
                S_list[i] = AR[j + N - 26]
                break
            else:
                S_list[i] = AR[j + N]
                break
S = "".join(S_list)
print(S)

Submission status: Accepted

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

low = s.lower()
plain = ''

for i in list(low):
    ASCII = ord(i)
    num = ASCII - 97
    num = (num + n) % 26
    ASCII = num + 97
    plain += chr(ASCII)

print(plain.upper())

Submission status: Accepted

Solution code:
t=int(input())
s=input()
s1=''
for i in s:
    if((ord(i)+t)>90):
        a=(ord(i)+t)-90
        if(a==1):
            s1+=chr(ord('A')+a-1)
        else:
            s1+=chr(ord('A')+a-1)
    else:
        s1+=chr(ord(i)+t)
print(s1)