Problem:


Score : 200 points

Problem Statement

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

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

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

Constraints

0 \leq N \leq 26

1 \leq |S| \leq 10^4

S consists of uppercase English letters.

Input

Input is given from Standard Input in the following format:

N
S

Output

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

Sample Input 1

2
ABCXYZ

Sample Output 1

CDEZAB

Note that A follows Z.

Sample Input 2

0
ABCXYZ

Sample Output 2

ABCXYZ

Sample Input 3

13
ABCDEFGHIJKLMNOPQRSTUVWXYZ

Sample Output 3

NOPQRSTUVWXYZABCDEFGHIJKLM



Sample input:
2
ABCXYZ


Sample output:
CDEZAB

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
from copy import deepcopy

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

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

ans = []
for i in range(len(S)):
    x = S[i]
    num = alpha_dict[x]
    num += N
    num %= 26
    ans.append(beta_dict[num])

print(''.join(ans))

Submission status: Accepted

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

new = ''
for c in S:
    tmp = ord(c)+N
    if tmp > 90:
        tmp -= 26
    new += chr(tmp)

print(new)

Submission status: Accepted

Solution code:
#ABC146 B
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

N = ni()
S = si()
# SS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# SSS = 'NOPQRSTUVWXYZABCDEFGHIJKLM'
S1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = []

for i,s in enumerate(S) :
    idx = S1.find(s)
    idx += N
    ans.append(S1[idx:idx+1])

aans = ''

for a in ans:
    aans += a

print(aans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

x = ''
i = 0

for c in s:
	a = alpha2num(c)
	b = a + n
	if (b > 26):
		b = b - 26
	x = x + num2alpha(b)
	i += 1

print(x)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans = str()
for s in S:
    ans += chr(((ord(s)-ord('A')) + N)%(ord('Z')-ord('A') + 1) + ord('A'))
print(ans)

Submission status: Accepted

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

s=[]
for i in range(len(S)):
  if ord(S[i])+N >= 91:
    j = (ord(S[i])+N -65)%26+65
    s.append(chr(j))
  else:
    s.append(chr(ord(S[i])+N))
print(''.join(s))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
conv = []
rev = 0

for s in S:
  if s == 'Z':
    rev = 26 - N
    conv.append(chr((ord(s) - ord('A') - rev) % 26 + ord('A')))    
  else:
    conv.append(chr((ord(s) - ord('A') + N) % 26 + ord('A')))

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

Submission status: Accepted

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

ns = []

for ch in S:
    ns.append(chr((ord(ch) - ord('A') + N) % 26 + ord('A')))

print("".join(ns))

Submission status: Accepted

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

str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

result = ''

for char in S:
  result += str[(str.find(char)+N) % 26]
  
print(result)

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    S = input()

    ans = ''
    for s in S:
        n = ord(s) + N
        if n > 90:
            n -= 26
        ans += chr(n)
    print(ans)


main()

Submission status: Accepted

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

    str_list = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

    ans_list = []
    for i in range(len(s)):
        tmp = str_list.find(str(s[i]))
        index_tmp = tmp+n
        if index_tmp >= len(str_list):
            index_tmp -= len(str_list)

        ans_list.append(str_list[index_tmp])

    mojiretsu = ''.join(ans_list)
    print(mojiretsu)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#import math.sqrt as sqrt
#data = list(map(input().split()))
N = int(input())
S = input()

ans =""

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

n = int(len(S))

for i in range(n):
    for j in range(len(alf)):
        if S[i]==alf[j]:
            if j+N < len(alf):
                ans += alf[j+N]
            else:
                k = int(j+N-len(alf))
                ans += alf[k]




print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
H = ['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 = 0
ans = []

for i in range(0, len(S)):
  tmp = H.index(S[i])
  tmp = tmp + N
  ans.append(H[tmp])

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
A = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
print("".join([A[(A.index(s)+N)%(len(A))] for s in S]))

Submission status: Accepted

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

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

for s in S:
    for i in range(26):
        if s==ref[i]:
            x.append(ref[(i+N)%26])
for i in range(len(x)):
    print(x[i],end="")

Submission status: Accepted

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

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

for i in range(len(S)):
  old_index=a_z.index(S[i])
  new_index=(old_index+n)%26
  new_S.append(a_z[new_index])

print(*new_S, sep='')

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

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


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

alpha_swap = {v:k for k, v in alpha_dict.items()}
s_val = [(alpha_dict[val] + n) % 26 for val in s]
ans = ''
for val in s_val:
    ans += alpha_swap[val]

print(ans)

Submission status: Accepted

Solution code:
import sys
import math
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

num = I()
s = S()
N = len(s)

ret = {"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}
t = {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"}

ans = ""
for i in range(N):
  ans += t[(ret[s[i]] + num) % 26]
print(ans)

Submission status: Accepted

Solution code:
value = int(input())
data = input()
result = ''
value = value % 26
for i in data:
    if ord(i) + value > 90:
        result += chr(64 + ord(i) + value - 90)
    else:
        result += chr(ord(i) + value)
print(result)

Submission status: Accepted

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

# print(ord('A'), ord('Z'))

def getConverseCodes(args):
    converseCodes = ''
    for s in args:
        #アスキーコードに変換
        s = ord(s)
        if s + N <= 90:
            s = s + N
        else:
            s = (s + N - 65) % 26 + 65
       #アスキーコードから文字を取得
        s = chr(s)
        converseCodes += s
    return converseCodes


print(getConverseCodes(S))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alpha2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
alpha2 = list(alpha2)
for i in range(len(s)):
  num = alpha.index(s[i])
  s = s[:i]+alpha2[num+n]+s[i+1:]
print(s)

Submission status: Accepted

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

enc = ""

for char in S:
  ASCII = ord(char)+N
  if ASCII >= 91:
    ASCII-=26
  enc += chr(ASCII)

print(enc)

Submission status: Accepted

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

S = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

s_split = list(s)

# print(s_split)

new_str_list = []
for i in range(len(s)):
    no = S.find(s[i])
    number = (no+n)%26
    new_str = S[number]
    # print(no)
    # print(new_str)
    new_str_list.append(new_str)

# print(new_str_list)
print("".join(new_str_list))

Submission status: Accepted

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

A_num = ord('A')
Z_num = ord('Z')
ans = ''

for char in s:
  next_char_num = ord(char) + n
  
  if next_char_num > Z_num:
    next_char_num = A_num - 1 + (next_char_num % 90)
  ans += chr(next_char_num)

print(ans)

Submission status: Accepted

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

alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
a = ''
for ss in s:
    a += alp[int(alp.find(ss))+n]
print(a)

Submission status: Accepted

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

a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
dic = {a[i]:i for i in range(len(a))}
dic_ = {i:a[i] for i in range(len(a))}

len_a = len(dic)
ans = ""
for s in S:
    # print("iter alpha",s)
    num = dic[s]
    # print("alpha num",num)
    new_num = num + N
    # print("new_num",new_num)
    if new_num > 25:
        # print("here")
        new_num = new_num - 26
        # print("",new_num)
    else:
        pass
    ans += dic_[new_num]
    # print("temp ans",ans)
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
T=[0]*len(S)

alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(0,len(S)):
  u=alpha.index(S[i])
  a=u+N
  if a>=26:
    a-=26
  T[i]=alpha[a]

print("".join([str(n) for n in T]))

Submission status: Accepted

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

alpha2num = lambda c: ord(c) - ord('A') + 1
num2alpha = lambda c: chr(c+64)
list = []
for i in S:
    number = alpha2num(i)
    number_after = number + N
    if number_after > 26:
        number_after = number_after - 26
    i = num2alpha(number_after)
    list.append(i)

print(''.join(list))

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = []
for v in s:
    a = ord(v) + n
    if a > 90:
        a = 64 + a - 90
    ans.append(chr(a))
print("".join(ans))

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
k=list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
a=[]
for i in s:
    a.append(k[k.index(i)+n])
print("".join(a))

Submission status: Accepted

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

begin = ord('A')
end = ord('Z')
modulo = end - begin + 1

ans = [(ord(c) - begin + n) % modulo for c in s]
ans = ''.join([chr(o + begin) for o in ans])

print(ans)

Submission status: Accepted

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

s = list(S)
alphabet = [chr(i) for i in range(65, 65 + 26)]

dst = ''
for k in range(len(s)):
  for i in range(26):
    if alphabet[i] == s[k]:
      num = (i + N) % 26
      dst = dst + alphabet[num]
      break
print(dst)

Submission status: Accepted

Solution code:
import string
import itertools


def main(n: int, s: str):
    # print(n, s)
    # letters_cycle = itertools.cycle(string.ascii_uppercase)
    letters_cycle = string.ascii_uppercase + string.ascii_uppercase

    print(''.join([
        letters_cycle[ord(ch) - 65 + n]
        for ch in s
    ]))


if __name__ == '__main__':
    a = [input() for i in range(2)]

    main(int(a[0]), a[1])

Submission status: Accepted

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

dif = ord('A')
for i in range(len(s)):
  code = ((ord(s[i])+n) % dif) % 26
  print(chr(code+dif),end='')
print()

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","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]

for i in range(len(S)):
    for j in range(52):
        if S[i] == alphabet[j]:
            S[i] = alphabet[j+N]
            break

print("".join(S))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
L = len(S)
a1 = "a"
alpha  = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range (0,L):
  for j in range (0,26):
    if S[i] == alpha[j]:
      a1 = a1 + alpha[j+N]
print(a1[1:L+1])

Submission status: Accepted

Solution code:
l=[chr(i) for i in range(65,65+26)]
N=int(input())
S=list(input())
w=''
for s in S:
    w+=l[l.index(s)+N] if l.index(s)+N <= 25 else l[l.index(s)+N-26]
print(w)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
answer=""
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','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i in range(len(s)):
    answer+=alphabet[alphabet.index(s[i])+n]
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def rotate_string(s, n):
    s = s.lower()
    result = ""
    for i in range(len(s)):
        chr_num = 97 + (((ord(s[i]) + n) - 97) % 26)
        result += chr(chr_num)
    return result.upper()


def solve():
    n = int(input())
    s = input()
    print(rotate_string(s,n))


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
#import sys
#input = sys.stdin.readline
def main():
    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))
if __name__ == '__main__':
    main()

Submission status: Accepted

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

def rot_n(c, n):
    return chr((ord(c) - ord('A') + n) % 26 + ord('A'))

print(''.join((rot_n(c, n) for c in s)))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
import string
ABC = list(string.ascii_uppercase)
for i in range(len(s)):
    s[i] = ABC[(ABC.index(s[i]) + n) % 26]
for i in range(len(s)):
    print(s[i], end = '')
print('\n')

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
res = ''
for s in S:
  b = ord(s) + N
  while b > ord('Z'):
    b -= (ord('Z')-ord('A')+1)
  res += chr(b)
print(res)

Submission status: Accepted

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

all_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

result = ''
for i in range(len(s)):
    for j in range(len(all_)):
        if s[i] == all_[j]:
            result += all_[(j+n)%len(all_)]
            break

print(result)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = ''
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']
for i in range(0, len(s)):
    for j in range(0, 26):
        if s[i] == alf[j]:
            if j+n > 25:
                ans += alf[j+n-26]
            else:
                ans += alf[j+n]
print(ans)

Submission status: Accepted

Solution code:
import sys
N = int(sys.stdin.readline())
S = sys.stdin.readline().rstrip()

al = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans =''
for s in S:
    for i in range(len(al)):
        if s == al[i]:
            ans +=al[i+N]
            break
print(ans)

Submission status: Accepted

Solution code:
import sys

def num2alpha(c):
    return chr(c+64)

def alpha2num(c):
    return ord(c) - ord('A') + 1

def solve(n, s):
    for s_i in s:
        print(num2alpha((alpha2num(s_i) + n - 1) % 26 + 1), end="")
    print("")

if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    s = sys.stdin.readline().strip()
    solve(n, s)

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
t=['a']*(len(s))
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(s)):
    c=list.index(s[i])+n if list.index(s[i])+n <= 25 else list.index(s[i])+n-26
    t[i]=list[int(c)]
print(*t,sep='')

Submission status: Accepted

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

def getConverseCodes(args, i):
	converseCodes = ''
	for s in args:
		s = ord(s)
		if 65 <= s and s<= 90:
			s = s + i
		elif 97 <= s and s <= 122:
			s = s + i
		#アスキーコードから文字を取得
		if s >= 91:
			s -= 26
		s = chr(s)
		converseCodes += s
	return converseCodes

for i in range(len(s)):
	a.append(getConverseCodes(s[i],n))
print ("".join(a))

Submission status: Accepted

Solution code:
N = int(input())

alpha = input()

str_alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'


new_str_alphabet=''
for i, alphabet in enumerate(alpha):
    new_idx = str_alphabet.find(alphabet) + N
    new_alphabet = str_alphabet[new_idx%26]
    new_str_alphabet = new_str_alphabet + new_alphabet

print(new_str_alphabet)

Submission status: Accepted

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

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in range(len(s)):
    moji = s[i]
    ans += a[(a.find(moji) + n )% 26]
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
output = ""
for c in range(len(s)):
    num = alpha.find(s[c]) + n
    if num > 25:
        num -= 26
    output = output + alpha[num]
print(output)

Submission status: Accepted

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

result = list()
for x in S:
    c = ord(x) + N
    result.append(chr((c%90)+64 if c > 90 else c))

print(''.join(result))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
for j in range(N):
    S_ = []
    for i in S:
        if ord(i) == 90:
            mozi = chr(65)
        else:
            mozi = chr(ord(i)+1)

        S_.append(mozi)
    S = S_
for i in S:
    print(i,end="")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = []
for i in s:
    ask = ord(i)
    if (ask+n) > ord('Z'):
        a = n+ask-ord('Z')
        ans.append(chr(ord('A')+a-1))
    else:
        ans.append(chr(ask+n))
print("".join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
output = ''
for x in s:
  num = ord(x)+n
  if num <= 90:
    output += chr(num)
  else:
    output += chr(num%90+64)
print(output)

Submission status: Accepted

Solution code:
li = [chr(i) for i in range(65,65+26)]
n = int(input())
s = input()
ans = ""
for i in s:
    num = int(li.index(i))+n
    if num>25:
        num -= 26
    ans += li[num]
print(ans)

Submission status: Accepted

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

alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

for s in S:
    snum = alpha.index(s)
    henkango = (snum + N) % 26
    print(alpha[henkango],end='')

print('')

Submission status: Accepted

Solution code:
n=int(input())
a=input()
b=''
for i in a:
  x=ord(i)+n

  if x>90:
    x=x-26
  b=b+chr(x)
print(b)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
s1='#'
for x in s:
 	t1=ord(x)+n
 	if(t1>90):
 		s1+=chr(t1-91+65)
 	else:
 		s1+=chr(t1)
print(s1[1:])

Submission status: Accepted

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

import string
alf = string.ascii_uppercase

ans =''
for i in s:
    #print(i)
    for index,j in enumerate(alf):
        #print(j)
        if i == j:
            num = (index+n)%26
            ans += alf[num]

print(ans)

Submission status: Accepted

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

string = ['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']
letter = []
ans = []

for i in s:
    letter.append(i)

for i in letter:
    for j in range(0, 26):
        if  i == string[j]:
            tmp = j + n
            #print(tmp)
            if tmp > 25:
                tmp = tmp % 26
            ans.append(string[tmp])

#print(ans)
print(''.join(ans))

Submission status: Accepted

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

def rot(s):
    alpha2num = lambda c: ord(c) - ord('A')
    num=alpha2num(s)
    return chr((num+N)%26+65)

l=[]
for i in range(len(S)):
    l.append(rot(S[i]))
print(''.join(l))

Submission status: Accepted

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

for i in range(len(s)):
  a = (ord(s[i])+n)
  if a > ord('Z'):
    a = a - ord('Z') + ord('A') - 1
  s[i] = chr(a)

print(*s, sep='')

Submission status: Accepted

Solution code:
a=[chr(i) for i in range(65,65+26)]
a=a+a
b=''
n=int(input())
s=input()
for i in s:
  for j in range(26):
    if i==a[j]:
      b=b+a[j+n]
      break
print(b)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = int(input())
    s = input()
    ans=""


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

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
alpha_dict = {}
num2alpha = lambda c: chr(c+64)
alpha2num = lambda c: ord(c) - ord('A') + 1
ans = []
for item in s:
  k = (alpha2num(item)+n)%26
  if k == 0:
    k = 26
  ans.append(num2alpha(k))
L=''.join(ans)
print(L)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
# s = list(input())
s = input()
s = s.lower()
# print(s)
alpha = [chr(ord('a') + i) for i in range(26)]
# print(alpha)
# print(alpha)
# alpha
# for i in srange(n):
# m = n % 25
ans = []
for c in s:
  for i, p in enumerate(alpha):
    if c == p:
      # print(i)
      i = i + n
      i = i % 26
      ans.append(alpha[i].upper())
      # print(i)
      # m = (i+m) % 25
      # print(alpha[m])
# print(ans)
ans = "".join(ans)
print(ans)

Submission status: Accepted

Solution code:
def rot_n(c, n):
    return chr((ord(c) - ord("A") + n) % 26 + ord("A"))


def main():
    N = int(input())
    S = input()
    S = list(map(lambda c: rot_n(c, N), list(S)))
    print("".join(S))


main()

Submission status: Accepted

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

n = int(input())
s = input().replace('\n', '')

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

Submission status: Accepted

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

alfa = ["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)):
    num = alfa.index(S[i])
    num += N
    if num >= 26:
        num -= 26
    S2.append(alfa[num])

for i in range(len(S2)):
    print(S2[i], end="")
print("")

Submission status: Accepted

Solution code:
a = int(input())
b = list(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')))
    return "".join(ns)

result = caesar(b, a)
print(result)

Submission status: Accepted

Solution code:
import string

N = int(input())
S = list(input())
alphabet = list(string.ascii_uppercase)
ans = list()
for target in S:
	# アルファベットをN個ずらす
	# index out of rangeを防ぐために26で割ったあまりを求める
	ans.append(alphabet[(alphabet.index(target)+N)%26])
print(''.join(ans))

Submission status: Accepted

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

n = int(n)

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

res = ""

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans = [0] * len(S)
alpha_list = [chr(i) for i in range(65, 65+26)]
alpha_dict = {}
for i in range(len(alpha_list)):
    alpha_dict[alpha_list[i]] = i

for i in range(len(S)):
    s = S[i]
    pos = alpha_dict[s]
    if pos + N < 26:
        ans[i] = alpha_list[pos + N]
    else:
        pos = pos - 26
        ans[i] = alpha_list[pos + N]

print(*ans, sep = "")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32
a = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')


def solve(N: int, S: str):
    al = a+a
    ans = []
    for i in range(len(S)):
        ans += al[al.index(S[i])+N]

    print(''.join(ans))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

alph = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for a in s:
    s1.append(alph[(alph.index(a) + n)%26])

print("".join(s1))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
slis = list(s.lower())
anslis = []
alis = []
for i in slis:
    anslis.append(ord(i)-97+n)
for c,i in enumerate(anslis):
    if i > 25:
        anslis[c] = i%26
    alis.append(chr(anslis[c] + 97))
ans = "".join(alis)
ans = ans.upper()
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def f(c,x):
    o = ord(c)
    r = chr(o+x) if o+x <= ord("Z") else chr(o+x-26)
    return r

n = int(input())
s = input()
s_t = ""
for i in s:
    s_t += f(i,n)
print(s_t)

Submission status: Accepted

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


arph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
d = {s: i for i, s in enumerate(arph)}

_n = int(input())
_s = input()[:-1]


def idx(s, n):
    rs = ''
    for si in s:
        i = d[si]
        i = (i + n) % 26
        si = arph[i]
        rs = rs + si

    print(rs)


idx(_s, _n)

Submission status: Accepted

Solution code:
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","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()
k = []
p = []
ans = ""
for i in range(len(S)):
    k.append(S[i])
for i in range(len(k)):
       for j in range(26):
           if k[i] == list[j]:
              p.append(list[j+n])
for i in range(len(k)):
    ans += p[i]
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
# upper-case A-Z
alp=[chr(i) for i in range(65,65+26)]
nS=[]
for i in range(len(S)):
  l=alp.index(S[i])
  nl=(l+N)%26
  nS.append(alp[nl])
print("".join(nS))

Submission status: Accepted

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

a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ad = {}

for i in range(26):
	ad[a[i]] = i

ans = ''
for i in range(len(s)):
	tmp = (ad[s[i]]+n)%26
	ans += a[tmp]

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

metamol = ""

for m in S:
    metamol += alphabet[(alphabet.index(m) + N) % 26]

print(metamol)

Submission status: Accepted

Solution code:
n = int(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'
       ]
S = input()
for i in range(len(S)):
  print(Alph[(Alph.index(S[i]) + n) % 26], end='')

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
res = []
for si in s:
    new = ord(si) + n
    if new > 90:
        new += 6
    res.append(chr(new))
print(''.join(res).upper())

Submission status: Accepted

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

def _s(): return sys.stdin.readline().strip()
def _i(): return int(sys.stdin.readline().strip())

n= _i()
s= _s()

def f(c,n):
    return chr((ord(c)-65+n)%26+65)

ans=""
for c in s: ans += f(c,n)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
print(''.join([chr((ord(c)+n)-26*(ord(c)+n>90)) for c in s]))

Submission status: Accepted

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

modN = N % 26

char_s = ""
numZ = ord('Z')
numA = ord('A')
for c in S:
    numC = ord(c)
    if (numC + modN > numZ):
        char_s += chr(numA + (modN - (numZ - numC) - 1))
    else:
        char_s += chr(numC + modN)
print(char_s)

Submission status: Accepted

Solution code:
import string

N = int(input())
S = input()
R = 26

d = dict(zip(string.ascii_uppercase, range(26)))
inv_d = {v: k for k, v in d.items()}

ans = ""

for c in S:
    i = d[c]
    new_i = (i + N) % R
    ans += inv_d[new_i]

print(ans)

Submission status: Accepted

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

alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
result = ''
for c in s:
    result += alp[alp.find(c)+n]

print(result)

Submission status: Accepted

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