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()
Z='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
List=[]
y=0
for i in range(len(S)):
  for j in range(len(Z)):
    if S[i]==Z[j]:
        y=Z[(j+N)%26]
    else:
        pass

  List.append(y)

a=List[0]
for i in range(1,len(S)):
    a=a+List[i]
    
print(a)

Submission status: Accepted

Solution code:
def NumToAlph(n):
    num=n%26
    if num==0:
        num=26
    if num==1:
        return 'A'
    elif num==2:
        return 'B'
    elif num==3:
        return 'C'
    elif num==4:
        return 'D'
    elif num==5:
        return 'E'
    elif num==6:
        return 'F'
    elif num==7:
        return 'G'
    elif num==8:
        return 'H'
    elif num==9:
        return 'I'
    elif num==10:
        return 'J'
    elif num==11:
        return 'K'
    elif num==12:
        return 'L'
    elif num==13:
        return 'M'
    elif num==14:
        return 'N'
    elif num==15:
        return 'O'
    elif num==16:
        return 'P'
    elif num==17:
        return 'Q'
    elif num==18:
        return 'R'
    elif num==19:
        return 'S'
    elif num==20:
        return 'T'
    elif num==21:
        return 'U'
    elif num==22:
        return 'V'
    elif num ==23:
        return 'W'
    elif num ==24:
        return 'X'
    elif num==25:
        return 'Y'
    else:
        return 'Z'

def AlphToNum(alph):
    if alph=='A':
        return 1
    elif alph=='B':
        return 2
    elif alph=='C':
        return 3
    elif alph=='D':
        return 4
    elif alph=='E':
        return 5
    elif alph=='F':
        return 6
    elif alph=='G':
        return 7
    elif alph=='H':
        return 8
    elif alph=='I':
        return 9
    elif alph=='J':
        return 10
    elif alph=='K':
        return 11
    elif alph=='L':
        return 12
    elif alph=='M':
        return 13
    elif alph=='N':
        return 14
    elif alph=='O':
        return 15
    elif alph=='P':
        return 16
    elif alph=='Q':
        return 17
    elif alph=='R':
        return 18
    elif alph=='S':
        return 19
    elif alph=='T':
        return 20
    elif alph=='U':
        return 21
    elif alph=='V':
        return 22
    elif alph=='W':
        return 23
    elif alph=='X':
        return 24
    elif alph=='Y':
        return 25
    else:
        return 26
        
N=int(input())
S=str(input())
T=''
for c in range(len(S)):
    T=T+NumToAlph(AlphToNum(S[c])+N)
print(str(T))

Submission status: Accepted

Solution code:
def rot13(c, n):
    if 'A' <= c and c <= 'Z':
        # 13 文字分ずらす
        return chr((ord(c) - ord('A') + n) % 26 + ord('A'))

    if 'a' <= c and c <= 'z':
        # 13 文字分ずらす
        return chr((ord(c) - ord('a') + n) % 26 + ord('a'))

    # その他の文字は対象外
    return c


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

for i in list(s):
    ans.append(rot13(i, n))

print(''.join(ans))

Submission status: Accepted

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

l = list(string.ascii_uppercase)

for i,s in enumerate(S):
  index = l.index(s)
  if index + N >= len(l):
    index = index + N - len(l)
    new_s = l[index]
  else:
    new_s = l[index+N]
  S[i] = new_s

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

Submission status: Accepted

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

l = list(s)

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

ans = []

for _ in l:
  num = alpha2num(_) + n
  if num > 26:
    num -= 26
  ans.append(num)

ans2 = [num2alpha(_) for _ in ans]

print(''.join(ans2))

Submission status: Accepted

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

cs = ""


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

print(cs)

Submission status: Accepted

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

ans = []
for i in range(len(s)):
    idx = ord(s[i]) + n
    if idx > 90 :
        idx = ord("A") + idx - 91
    ans.append(chr(idx))
print("".join(ans))

Submission status: Accepted

Solution code:
n = int(input())
a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
s = [i for i in input()]

b = []
for i in range(len(s)):
    for j in range(len(a)):
        if s[i]==a[j]:
            s[i] = a[(j+n)%26]
            break
print(''.join(s))

Submission status: Accepted

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

ord_list = []

for i in range(len(S)):
	tmp = ord(S[i])
	ord_list.append(tmp)

ans_num_list = []

for i in range(len(S)):
	if ord_list[i] + N <= 91:
		ans_num_list.append(ord_list[i] + N)
	else:
		ans_num_list.append(ord_list[i] + N - 26)

ans_list = [chr(i) for i in ans_num_list]

ans_list2 = []

for i in range(len(ans_list)):
	if ans_list[i] == "[":
		ans_list2.append("A")
	else:
		ans_list2.append(ans_list[i])

print("".join(ans_list2))

Submission status: Accepted

Solution code:
import sys

# import numpy as np
import math
from fractions import gcd
from collections import deque
import bisect

sys.setrecursionlimit(10000)


def main():
    # map(int, input().split())
    # l = list(map(int, input().split()))
    N = int(input())
    S = input()
    ret = ''
    for c in S:
        c_rep = chr(((ord(c)+N) - 65) % 26+65)

        ret = ret + c_rep
    print(ret)  # 1


if __name__ == "__main__":
    main()

Submission status: Accepted

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

def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

for i in range(len(S)):
    a = alpha2num(S[i])
    a=a+N
    while a>26:
        a=a-26
    S[i]=num2alpha(a)

print(''.join(S))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
str_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"]
str_list2 = str_list + str_list
for iter, i in enumerate(S):
    num = str_list.index(i)
    new_str = str_list2[num+N]
    if iter == 0:
        ans = new_str
    else:
        ans += new_str
print(ans)

Submission status: Accepted

Solution code:
def judge(S,N):
    a = [x for x in list(S)]
    lst = ["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"]
    mak = []
    llst = lst + lst
    for i in range(len(a)):
        for j in range(26):
            if a[i]==llst[j]:
                mak.append(llst[j+N])
    print("".join(mak))

N = int(input())
S = input()
judge(S,N)

Submission status: Accepted

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

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

Submission status: Accepted

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

newal = ""
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(al)):
  if(alp.index(al[i])+num>25):
    newal = newal + alp[(alp.index(al[i])+num)-26]
  else:
    newal = newal + alp[alp.index(al[i])+num]
  
print(newal)

Submission status: Accepted

Solution code:
n = int(input())
a = input()
for c in a:
    next_char = (65 + (ord(c) + n) % 91) if (ord(c) + n) >= 91 else (ord(c) + n)
    print(chr(next_char), end='')

Submission status: Accepted

Solution code:
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

t = int(input())
a_str = str(input())
answer = ""

a_uniquie = ''.join(set(a_str))

for i in a_str:
  for j in range(26):
    if i == a[j]:
      answer += a[j+t]
      break

print(answer)

Submission status: Accepted

Solution code:
k=int(input())
m = input()
codes = 65                    # 文字 a の文字コード
kosu = 26                      # 英字アルファベットの数
leng = len(m)                  # 文字列の長さ
c = ""

for i in range(leng):
    code = ord(m[i])           # i 文字目のコードを得る
    
    sa = code - codes
        #
    if sa>=0 and sa<kosu:
    	sa=(sa+k)%kosu
        #
    c = c + chr(sa + codes)    # 暗号文用のコードの格納
print(c)

Submission status: Accepted

Solution code:
a=input()
b=input()

list='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans=[]

for i in range(len(b)):
    num=(list.index(b[i])+int(a))%26
    ans.append(list[num])
    
ans=''.join(ans)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(len(s)):
        s[i] = al[(al.find(s[i])+n)%26]
print("".join(s))

Submission status: Accepted

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

N = int(input())
i =input()

result = caesar(i, -N)
print(result)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# Atcoder necoak answer
# https://atcoder.jp/contests/abc146/tasks/abc146_b

alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

n_txt = input()
n = int(n_txt)

s_txt = input()


for s_chr in s_txt:
    pos = alphabets.find(s_chr)
    print(alphabets[pos + n], end='')
print()

Submission status: Accepted

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

ans = []

t = n%26

li1 = {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"}
li2 = {"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}

for i in range(len(s)):
    temp = li2[s[i]]
    temp += t
    if temp > 25:
        temp -= 26
    
    ans.append(li1[temp])

print("".join(ans))

Submission status: Accepted

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

out = ""
for i in S:
    tmp = (ord(i) + N) % 91
    if tmp < 65:
        tmp = tmp + 65
    out = out + chr(tmp)

print(out)

Submission status: Accepted

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

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


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

print(''.join(ans))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
NS=[]
for i in range(len(S)):
  if ord(S[i])+N<=90:
    cnt=ord(S[i])+N
  else:
    cnt=ord(S[i])+N-26
  NS.append(chr(cnt))
ans = ''.join(NS)
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
N = list(map(int, input().split()))[0]
S = list(map(str, input().split()))[0]


print("".join(list(map(lambda x: chr(x + ord("A")), (np.array(list(map(ord, S))) - ord("A") + N) % 26))))

Submission status: Accepted

Solution code:
#
import sys
import math
import numpy as np
import itertools

# ひとつ入力
n = int(input())

# 文字列を一文字ずつのリストに代入 test は['t', 'e', 's', 't']
s = list(input())


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

Submission status: Accepted

Solution code:
n = int(input())
s = list(map(ord,input()))
ans = ""
for i in range(len(s)):
  s[i]+=n
  if s[i]>90:
    s[i]-=26
  ans+=chr(s[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'):
        tmp=ord(s[i])-ord('Z')
        tmp+=ord('A')+n-1
    else:
        tmp=ord(s[i])
        tmp+=n
    ans+=chr(tmp)
print(ans)

Submission status: Accepted

Solution code:
import sys

def increment(asc, N):
    new_int = asc + N
    if new_int > ord('Z'):
        new_int = new_int - ord('Z') + ord('A') - 1
    return new_int

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

out = ''
for c in list(S):
    asc = ord(c)
    new_c = chr(increment(asc, N))
    out += new_c

print(out)

Submission status: Accepted

Solution code:
n=int(input())
s=str(input())  
ans=str()
for j in range(len(s)):#文字列の長さ繰り返す
  index=ord(s[j])
    
  index = index + n
  
  if index >= 91:
    index =index - 26
  new_s=chr(index)#変換された文字
  ans += new_s
print(ans)

Submission status: Accepted

Solution code:
import string
lst = string.ascii_uppercase
N = int(input())
n = 26 - N
S = input()
output = ""
for s in S:
    indx = lst.index(s)
    output += lst[indx - n]

print(output)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans = [] 
for i in range(len(S)):
  if ord(S[i]) + N > 90:
    ans.append(chr(ord(S[i]) + N - 90 + 64))
  else:
  	ans.append(chr(ord(S[i])+N))
ans = ''.join(ans)
print(ans)

Submission status: Accepted

Solution code:
k = int(input())
n = list(input())
for i in range(len(n)):
    if ord(n[i]) + k > 90:
        n[i] = chr((ord(n[i]) + k)- 90 + 64)
    else:
        n[i] = chr(ord(n[i]) + k)
print("".join(n))

Submission status: Accepted

Solution code:
keyNum = int(input())
encodingString = str(input()).upper()
translated = ""

for letter in encodingString:
    n = ord(letter)
    n += keyNum

    if n > ord('Z'):
        n -= 26
    elif n < ord('A'):
        n += 26

    translated += chr(n)

print(translated)

Submission status: Accepted

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

a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

z = ''
for ss in s:
  for i in range(len(a)):
    if ss == a[i]:
      if i+n > 25:
        j = i+n -26
        z += a[j]
      else:
        z += a[i+n]

print(z)

Submission status: Accepted

Solution code:
n=int(input())
s=list(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"]
for i in range(len(s)):
  for j in range(26):
    if s[i]==a[j]:
      s[i]=a[((j+n)%26)]
      break
print(*s,sep="")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
answer = ["a"] * len(s)

for i in range(len(s)):
    #print(s[i])
    if((ord(s[i])+n)<=90):
        answer[i] = chr(ord(s[i])+n)
    else:
        answer[i] = chr(ord(s[i])+n-26)

answer=''.join(answer)
print(answer)

Submission status: Accepted

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

code = []
for c in S:
    if ord('A') <= ord(c) <= ord('Z'):
        code.append(chr((ord(c) - ord('A') + N) % 26 + ord('A')))

print("".join(code))

Submission status: Accepted

Solution code:
N = int(input())
S = [i for i in 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","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)):
  S[i] = A[A.index(S[i])+N]
print(''.join(S))

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 = int(input())
s = input()
for i in range(len(s)):
    for j in range(len(l)):
        if j+n > 25 and s[i] ==l[j]:
            s = s[:i] +l[j-26+n]+s[i+1:]
            break
        elif s[i] == l[j]:
            s = s[:i]+l[j+n]+s[i+1:]
            break
            
print(s)

Submission status: Accepted

Solution code:

def main():
    N = int(input())
    S = input()
    ch = ["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 S:
        #print(i)
        ind = ch.index(i)+N
        ans+= ch[ind%26]
    print(ans)


if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n = int(input())
s = input()
ans = ""
for i in range(len(s)):
    for j in range(26):
        if s[i] == a[j]:
            ans += a[(j+n)%26]
print(ans)

Submission status: Accepted

Solution code:
a=int(input())
s=input()
d=["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"]
S=list(s)
for i in range(len(S)):
  z=d.index(S[i])
  S[i]=d[z+a]
print("".join(S))

Submission status: Accepted

Solution code:
n=int(input())
s=str(input())
l=list(s)
t=len(s)

for i in range(t):
    if ord(l[i])+n<65+26:
        l[i]=chr(ord(l[i])+n)
    else:
        l[i]=chr(ord(l[i])+n-26)
ans="".join(l)
print(ans)

Submission status: Accepted

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

def _rot(c, n):
    if 'A' <= c and c <= 'Z':
        return chr((ord(c) - ord('A') + n) % 26 + ord('A'))
    if 'a' <= c and c <= 'z':
        return chr((ord(c) - ord('a') + n) % 26 + ord('a'))
    return c

def rotn(s, n):
    # ジェネレータ内包表記で文字列に ROT13 を適用する
    g = (_rot(c, n) for c in s)
    # 文字列に直す
    return ''.join(g)

print(rotn(s, n))

Submission status: Accepted

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

letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

newS = ''
for i, s in enumerate(S):
    letterIdx = (letters.index(s) + n)
    if letterIdx > 26-1:
        letterIdx -= 26
    newS = newS.__add__(letters[letterIdx])

print(newS)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
s = list(s)
l = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(0,len(s)):
  for j in range (0,26):
    if s[i] == l[j]:
      s[i] = l[(j+n)%26]
      break
s = ''.join(s)
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

str_dict = {}
for i in range(26):
    s = (i + N) % 26 + ord('A')
    str_dict[chr(ord('A') + i)] = chr(s)

new_str = []
for i in S:
    new_str.append(str_dict[i])

s = ''.join(new_str)

print(s)

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', 
    '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(len(a)):
        if s[i] == a[j]:
            ans += a[j+n]
            break

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#solve
def solve():
    n = II()
    s = ord("A")
    ss = S()
    ans = [chr(ord("A") + (ord(i) - ord("A") + n) % 26) for i in ss]
    print("".join(ans))
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

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

ans = ""

for char in list(s):
    ASCII = ord(char)
    num = ASCII - 65 
    num = (num + n) % 26
    ASCII = num + 65 
    ans += chr(ASCII)

print(ans)

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    s = input()
    ans = []
    a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    for _s in s:
        k = 0
        p = a.find(_s)
        if p + n >= 26:
            k = (p + n) % 26
        else:
            k = p + n
        ans.append(a[k])

    print("".join(ans))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = []
for c in s:
  c_code = (ord(c) + n) % 90
  if(c_code == 0):
    ans.append("Z")
  elif(c_code < 65):
    ans.append(chr(c_code + 64))
  else:
    ans.append(chr(c_code))
print("".join(ans))

Submission status: Accepted

Solution code:
# coding:utf-8
N = int(input())
S = input()
Snum = [ord(i)-65 for i in S]
chgnum = [(j + N) % 26 + 65 for j in Snum]
chgstr = [chr(k) for k in chgnum]
ans = "".join(chgstr)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
L = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
A = ''
for i in S:
    A+=L[(L.find(i)+N)%26]
print(A)

Submission status: Accepted

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

C = ['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(len(C)):
        if S[i] == C[j]:
            S[i] = C[(j + N) % 26]
            break

print(''.join(S))

Submission status: Accepted

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

print("".join(ans))

Submission status: Accepted

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import fractions
from functools import reduce
from operator import mul
import bisect
import sys
import logging
import heapq
import itertools

logging.basicConfig(level=logging.ERROR)

input = sys.stdin.readline

setrecursionlimit(1000000)


def main():
	n = int(input())
	s = input()[:-1]
	ans = ''
	for i in s:
		p = ord(i) +  n
		ans += chr(p if p < 91 else p-26)
	print(ans)

def factorization(n):
	if n<2:
		return []

	arr = []
	temp = n
	for i in range(2, int(-(-n**0.5//1))+1):
		if temp%i==0:
			cnt=0
			while temp%i==0:
				cnt+=1
				temp //= i
			arr.append([i, cnt])

	if temp!=1:
		arr.append([temp, 1])

	if arr==[]:
		arr.append([n, 1])

	return arr

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(numbers):
	return reduce(fractions.gcd, numbers)

def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

class PriorityQueue():
	def __init__(self):
		self.queue = []
	def push(self,i):
		heapq.heappush(self.queue,-i)
	def pop(self):
		return -1 * heapq.heappop(self.queue)
	def sum(self):
		return -sum(self.queue)

main()

Submission status: Accepted

Solution code:
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

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

for i in S:
    b = a.index(i) + N
    if b <= 25:
        print(a[b], end="")
    else:
        print(a[b-26], end="")

Submission status: Accepted

Solution code:
def is_upper(c):
    return ord('A') <= ord(c) and ord(c) <= ord('Z')


def is_lower(c):
    return ord('a') <= ord(c) and ord(c) <= ord('z')


def shift(c, k):
    if is_upper(c):
        return chr((ord(c) - ord('A') + k) % 26 + ord('A'))
    elif is_lower(c):
        return chr((ord(c) - ord('a') + k) % 26 + ord('a'))
    else:
        return c


def caesar(s, k, decode=False):
    if decode:
        k = -k
    return "".join([shift(c, k) for c in s])


N = int(input())
S = str(input())
enc = caesar(S, N)
print(enc)

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

result = []
for i in range(len(S)):
    al = alphabet.index(S[i])
    result.append(alphabet[al+N])

print("".join(result))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
SS = [chr(i) for i in range(65,65+26)]+[chr(i) for i in range(65,65+26)]
ss = [chr(i) for i in range(97,97+26)] +[chr(i) for i in range(97,97+26)]
ans = ""
for s in S:
    if s.islower():
        ans += ss[ord(s)-97+N]
    else:
        ans += SS[ord(s)-65+N]
print(ans)

Submission status: Accepted

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

rot = [] * 10 ** 14
for i in range(len(s)):
    rot.append(chr((ord(s[i]) - ord('A') + n) % 26 + ord('A')))
    print(rot[i], end = "")

Submission status: Accepted

Solution code:
import numpy as np

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

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

S_list = np.array([alpha2num(s) for s in S])

#print(S_list)
S_list_added = (S_list-1+N)%26+1
#print(S_list_added)

S_list_converted = [num2alpha(s) for s in S_list_added]
print("".join(S_list_converted))

Submission status: Accepted

Solution code:

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


plain = ""

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

print(plain)

Submission status: Accepted

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

def _rot(c,N):
    if 'A' <= c and c <= 'Z':
        c = chr((ord(c) - ord('A') + N) % 26 + ord('A'))
    if 'a' <= c and c <= 'z':
        c = chr((ord(c) - ord('a') + N) % 26 + ord('a'))
    return c

def rot(S,N):
    g = (_rot(c,N) for c in S)
    return ''.join(g)

print(rot(S,N))

Submission status: Accepted

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

char_list = list(n)
length = len(char_list)
result = []
if s != '0':
    for i in range(0,length):
        x = ord(char_list[i]) + int(s)
        if x > 90:
            x = x - 26
        result.append(chr(x))
        
elif s == '0':
    result = char_list
resultstr = ''.join(result)
print(resultstr)

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
alphabet_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"]
alphabet_indexes = []
for s_index in range(len(s)):
    for alphabet_index in range(len(alphabet_list)):
        if s[s_index] == alphabet_list[alphabet_index]:
            s_alphabet_index = (alphabet_index + n)%26
    alphabet_indexes.append(s_alphabet_index)
alphabets = []
for alphabet_index in alphabet_indexes:
    alphabets.append(alphabet_list[alphabet_index])

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
c = [ord(x) for x in s]
d = [x + n for x in c]
e = [x % 26 for x in d]

keys = [13,14,15,16,17,18,19,20,21,22,23,24,25,0,1,2,3,4,5,6,7,8,9,10,11,12]
values = ['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']
d = {k: v for k, v in zip(keys, values)}

ans = []
for x in e:
    ans.append(d[x])

print(''.join(ans))

Submission status: Accepted

Solution code:
n= int(input())
b=list(map(str,input()))
for i in range(0,len(b),1):
    b[i]=ord(b[i])+n
    if b[i]>90 :
        b[i]-=26
    print(chr(b[i]),end="")

Submission status: Accepted

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

alphabet = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
ans = []

for i in range(len(S)):
  num = alphabet.index(S[i])+N
  if num > 25:
    num -= 26
  ans.append(alphabet[num])
  
ans = ''.join(ans)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
length = len(S)
S0 = ''
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']
for i in range(length):
    for j in range(26):
        if S[i] == abc_list[j]:
            if j+N<=25:
                S0 += abc_list[j+N]
            else:
                k = j+N-26
                S0 += abc_list[k]
            break
print(S0)

Submission status: Accepted

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

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

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

print("")

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
s_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = s
for i in range(len(s)):
    fd = s_.find(s[i]) + n
    if fd >= 26:
        fd -= 26
    ans[i] = s_[fd]
print(''.join(ans))

Submission status: Accepted

Solution code:
def encrypt(text,s):
  result = ""
  for i in range(len(text)):
    char = text[i]
    if (char.isupper()):
        result += chr((ord(char) + s-65) % 26 + 65)
  return result
n = int(input())
s = str(input())
print(encrypt(s, n))