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:
a=int(input())
s=input()
list= "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
slist = [c  for c in s]
ans = str()
for si in slist:
    i = list.find(si)
    ans += list[(i+a)%26]
print(ans)

Submission status: Accepted

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

for i in range(len(s)):
    if ord(s[i])+n > 90:
        t += chr(64+ord(s[i])+n-90)
    else:
        t += chr(ord(s[i])+n)
    
print(t)

Submission status: Accepted

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

tmp = [alpha_lst[(int(alpha_lst.index(i))+n)%26] for i in s]
#tmp = [alpha_lst.index(i) for i in s]
print(''.join(tmp))

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']
b = 0
for i in range(len(s)):
    for j in range(len(a)):
        if s[i] == a[j]:
            if j+n > len(a)-1:
                s[i] = a[j+n-len(a)]
                break
            else:
                s[i] = a[j+n]
                #print(s)
                break
print(''.join(s))

Submission status: Accepted

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

n = int(input())
str = input()
alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
str_list=list(str)
alphabet_list=list(alphabet)
#print(str_list)
#print(alphabet_list)
#Sprint(n%26)
i=0
j=0
if n==0:
    pass
else:
 for i in range(len(str)):
    for j in range(len(alphabet)):
        #print(str_list[i])
        #print(alphabet_list[j])
     if str_list[i]==alphabet_list[j]:
            #print(i)
            #print(j)
           if n%26+j >= 26:
             #print(1)
             #str_list[i]=alphabet_list[n%26+j-27]
             str_list[i]=alphabet_list[(n%26+j)%26]
             break
             #26文字を超えたときどうするかか
             #2パターン用意すればいいじゃない
           else:
                #print(j)
                #print((n%26+j)%25)

                str_list[i]=alphabet_list[(n%26+j)%26]
                break
     else:
           pass
#print(str_list)
mojiretu=''.join(str_list)
print(mojiretu)

Submission status: Accepted

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

for k in s:
  a = ord(k) + n
  if a>90:
    a=a-26
    result = result + chr(a)
  else:
    result = result + chr(a)

print(result)

Submission status: Accepted

Solution code:
n = int(input())
S = input()
def rot_encode(n):
    from string import ascii_lowercase as lc, ascii_uppercase as uc
    lookup = str.maketrans(lc + uc, lc[n:] + lc[:n] + uc[n:] + uc[:n])
    return lambda s: s.translate(lookup)
print(rot_encode(n)(S))

Submission status: Accepted

Solution code:
import itertools
N = int(input())
S = input()
li = [i for i in S]
d_alpa = {'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}

keys = []
for i in li:
  va = d_alpa[i]+N
  if va <= 25:
    f_va = va
  elif va > 25:
    f_va = va - 26
  key = [k for k, v in d_alpa.items() if v == f_va]
  keys.append(key)

  
flatten_k = list(itertools.chain.from_iterable(keys))
k = ''.join(flatten_k)
print(k)

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"]
output = ""
for i in range(len(S)):
    num = ord(S[i])-65
    output += A[(N+num)%26]
print(output)

Submission status: Accepted

Solution code:
import math

n=int(input())
s=input()
t=''
num1=lambda c:chr(c+65)
for i in range(len(s)):
  t+=num1((ord(s[i])-65+n)%26)
print(t)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
S_=[]
T=['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 j in range(len(S)):
    for i in range(len(T)):
        if S[j] == T[i]:
            if i+N>=len(T):
                S_.append(T[i+N-len(T)])
            else:
                S_.append(T[i+N])
            break

y=""
for x in S_:
    y+=x

print(y)

Submission status: Accepted

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

new_str = ''
for x in string:
    if (ord(x) + num) > ord('Z'):
        new_str = new_str + chr((ord(x) + num) - 26)
    else:
        new_str = new_str + chr(ord(x) + num)

print(new_str)

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=[i.upper() for i in A]
##print(A)
S=list(S)
for i, a in enumerate(S):
    S[i]=A.index(a)+N
    if S[i]>25:
        S[i]=S[i]-26
    S[i]=A[S[i]]

print("".join(S))

Submission status: Accepted

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

res = ''
for i in list(s):
    ascii = ord(i)
    a = ascii + n
    if a >= 91:
        b = a - 91
        res += chr(65 + b)
    else:
        res += chr(a)

print(res)

Submission status: Accepted

Solution code:
char_to_ind = dict()
ind_to_char = dict()
for i, char in enumerate("ABCDEFGHIJKLMNOPQRSTUVWXYZ"):
    char_to_ind[char] = i
    ind_to_char[i] = char


def solve(n, s):
    return "".join([ind_to_char[(char_to_ind[c] + n) % 26] for c in s])


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


def test():
    assert solve(2, "ABCXYZ") == "CDEZAB"
    assert solve(0, "ABCXYZ") == "ABCXYZ"
    assert solve(13, "ABCDEFGHIJKLMNOPQRSTUVWXYZ") == "NOPQRSTUVWXYZABCDEFGHIJKLM"


if __name__ == "__main__":
    test()
    main()

Submission status: Accepted

Solution code:
n = int(input())
s_old = input()
s = str(s_old).lower()

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

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

print(answer.upper())

Submission status: Accepted

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

N = int(a)
S = b

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

st =""

for c in S:
    n = alpha_dict[c]
    n = n + N
    if (n > 26):
        n = n - 26
    keys = [k for k, v in alpha_dict.items() if v == n]
    st += str(keys[0])
    
print(st)

Submission status: Accepted

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

output = ""

for char in list(S):
    ASCII = ord(char)
    num = ASCII - 65
    num = (num + N) % 26
    ASCII = num + 65
    output += chr(ASCII)

print(output)

Submission status: Accepted

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

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

for i in S:
    print(alist[(alist.index(i)+N)%26],end="")

Submission status: Accepted

Solution code:
n=int(input())
s=input()
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']
S=list(s)
for i in range(len(S)):
  idx=lst.index(S[i])
  S[i]=lst[(idx+n)%(len(lst))]
t=''.join(S)
print(t)

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
answer = ''
alphabets = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
alphabets_dict = {
  '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 ss in s:
  num = alphabets_dict[ss]
  answer += alphabets[(num + n) % 26]
print(answer)

Submission status: Accepted

Solution code:
from string import ascii_uppercase

A = dict(zip(ascii_uppercase, range(26)))
B = list(ascii_uppercase)

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

def trans(c):
    return B[(A[c] + N) % 26]

print(''.join(list(map(trans, list(S)))))

Submission status: Accepted

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

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

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

print(enc.upper())

Submission status: Accepted

Solution code:
N=int(input())
S = [a for a in input()]

t_1 = [chr(i) for i in range(65,65+26)]
t_2 = [chr(i) for i in range(65,65+26)]
t=t_1+t_2
new=[]
for i in S:
  num = t.index(i)+N
  new.append(t[num])
print("".join(new))

Submission status: Accepted

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

Submission status: Accepted

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

a = [chr(i) for i in range(65, 65+26)]
c = []
for i in range(len(s)):
    j = 0
    while s[i] != a[j]:
        j+=1
    b = (j+n)%26
    c.append(a[b])
d = c[0]
for i in range(len(c)-1):
    d += c[i+1]
print(d)

Submission status: Accepted

Solution code:
strs = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'  
shift = int(input())
data = []
inp = input()
for i in inp:                     #iterate over the text not some list
    data.append(strs[(strs.index(i) + shift) % 26]) 
output = ''.join(data)
print(output)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


class Solver(object):
    def __init__(self):
        pass

    def solve(self, N, S):
        ans = ""
        for s in S:
            ans += chr(((ord(s)-65)+N) % 26+65)
        return ans


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

    solver = Solver()
    print(solver.solve(N, S))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for s in S:
    new_string += (alphabets[(alphabets.index(s) + N) % 26])

print(new_string)

Submission status: Accepted

Solution code:
def is_upper(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'))
  else:
    return c
def caesar(s, k):
  return "".join([shift(c, k) for c in s])
N = int(input())
S = input()
enc = caesar(S, N)
print(enc)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
s = list(s)
string = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

for i in range(len(s)):
    if string.index(s[i]) + n <= 25:
        s[i] = string[string.index(s[i]) + n]
    else:
        s[i] = string[string.index(s[i]) + n-26]

print(*s, sep='')

Submission status: Accepted

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

Alpha = ['A', 'B','C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
         '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_index = []
for i in S:
    S_index.append(Alpha.index(i))
    
S_plus = map(lambda x: x + N, S_index)

output_w = []
for j in S_plus:
    output_w.append(Alpha[j])
    
answer = ''.join(output_w)
print(answer)

Submission status: Accepted

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

for i in range(n):
    p = ord(s[i])
    p += k
    if p > 90:
        p -= 26
    s[i] = chr(p)
print(''.join(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
k=int(input())
s=input()
n=len(s)
ans=""
for i in s: 
    extra=(ord(i)-65)
    extra+=k 
    extra%=26 
    ans+=chr(65+extra)
print(ans)

Submission status: Accepted

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

chars = list(s)

alpha2num = lambda c: ord(c) - ord('A') + 1
num = []
for i in range (0,len(chars)):
  if alpha2num(chars[i])+n >26:
    num.append(alpha2num(chars[i])-26+n)
  else:
    num.append(alpha2num(chars[i])+n)

num2alpha = lambda c: chr(c+64)
alp = []
for i in range (0,len(num)):
  alp.append(num2alpha(num[i]))

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

for i in range(len(S)):
  m = al.index(S[i])
  n = (1 + m + N) % 26 - 1
  Sr.append(al[n])
  
print(''.join(Sr))

Submission status: Accepted

Solution code:
number = int(input())
words = list(input())

# A:65 Z:90 26種類
offset = 65
answer = ""

for i in words:
    num = (ord(i) - offset + number) % 26 + offset
    answer += chr(num)

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def get_str_leading_n(string, alphabets, N):
    index_ = (alphabets.index(string.upper()) + N) % 26
    return alphabets[index_]
output = "".join(list(map(lambda p: get_str_leading_n(p, alphabets, N), S)))
print(output)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
alphabet = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
out=[]
for s in S:
    index = alphabet.index(s)
    new_index = (index+N)%len(alphabet)
    new_s = alphabet[new_index]
    out.append(new_s)
print(''.join(out))

Submission status: Accepted

Solution code:
a=[chr(ord('A') + i) for i in range(26)]
a=a*3
n=int(input())
s=input()
t=""
for i in s:
    t+=a[a.index(i)+n]
print(t)

Submission status: Accepted

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

ans = []

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

for alpha in s:
    now_alpha_num = alpha_dict[alpha]
    if (now_alpha_num + n) <= 26:
        return_alpha = [k for k, v in alpha_dict.items() if v == now_alpha_num + n]
    else:
        return_alpha = [k for k, v in alpha_dict.items() if v == now_alpha_num + n - 26]

    ans.append("".join(return_alpha))

print("".join(ans))

Submission status: Accepted

Solution code:
num2alpha = lambda c: chr(c+64)
alpha2num = lambda c: ord(c) - ord('A') + 1
N = int(input())
S = input()
s_list = list(S)
ANS = ''
if N >= 27:
    kazu = int(N/26)
    hiku = int(kazu * 26)
    N = (N - hiku)
for i in s_list:
    AA = (N + alpha2num(i))
    if AA >= 27:
        AA = AA - 26
    ANS += num2alpha(AA)
print(ANS)

Submission status: Accepted

Solution code:
A = ord('A')

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

ans = ""
for s in S:
  offset = ord(s) - A
  new_code = (offset + N) % 26 + A
  ans += chr(new_code)

print(ans)

Submission status: Accepted

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

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

for i in range(len(S)):
  n = al.index(S[i])
  Sr.append(al[(1 + n + N) % 26 - 1])
  
print(''.join(Sr))

Submission status: Accepted

Solution code:
N=int(input())
# アルファベットをずらす数
S=input()
# 復号した文字列の結果を格納
result = ""
for c in S:
    # 復号する処理
    if ord('a') <= ord(c) <= ord('z') :
        result = result + chr(abs(((ord(c) + N + ord('a')) % 26)) + ord('a'))
    else :
        result = result + chr(abs(((ord(c) + N + ord('A')) % 26)) + ord('A'))

print (result)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
l = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for i in range(len(S)):
    a = l.index(S[i])+N
    if a > 25:
        ans += l[a-26]
    else:
        ans += l[a]
print(ans)

Submission status: Accepted

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

new_alph = [i for i in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ']
new_S = [i for i in S]

for i in range(len(new_S)):
    try:
        new_S[i] = new_alph[new_alph.index(new_S[i])+N]
    except:
        new_S[i] = new_alph[new_alph.index(new_S[i])+N-26]
        
ans = ''.join(new_S)

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
s = input()
ans = ""
for c in s :
    ans = ans + chr(abs(((ord(c) + n - ord('A')) % 26)) + ord('A'))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def getChar(char, num):
    if num > 25:
        num %= 26

    if num + ord(char) > 90:
        num -= 26

    return chr(ord(char) + num)

result =""
for i in s:
    result += getChar(i, n)

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def RotN():  
    N = int(input())
    alfabet = input()
    
    alfabet2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    count = []
    chara = ""
    for alfa in alfabet:
        for i, alfa2 in enumerate(alfabet2):
            if alfa2==alfa:
                c = i+N
                if c>=26:
                    c=c-26
                    chara+=alfabet2[c]
                    
                else:
                    chara+=alfabet2[c]
    print(chara)
if __name__ == "__main__":
    RotN()

Submission status: Accepted

Solution code:
strs='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'.split(' ')
num=int(input())
alphas=list(input())
new_alphas=[]
new_num=0
for a in alphas:
    new_num=(num+strs.index(a))%26 
    new_alphas.append(strs[new_num])
print(''.join(new_alphas))

Submission status: Accepted

Solution code:

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

s = []
p = []
P = []

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

s = list(S)

for i in s:
    o = alf.index(i)
    o += N
    if o > 25:
        o = o - 25
        o -= 1
        p.append(str(alf[o]))
        P = ','.join(p)
        P = P.replace(',',"")
    else:
        p.append(str(alf[o]))
        P = ','.join(p)
        P = P.replace(',',"")

print(P)

Submission status: Accepted

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

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

answer = ''
for i in s:
  count=0
  for k in master:
    if i == k:
      if count + n > 25:
        minus = 25 - (count-1)
        answer = answer + master[n - minus]
      else:
        answer = answer + master[count + n]
    count = count + 1

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
S = str(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']
return_word = []
for i in range(len(S)):
  num = alphabet.index(S[i])
  return_num = N + num
  if return_num > 25:
    return_num = return_num - 26
  return_alphabet = alphabet[return_num]
  return_word.append(return_alphabet)
final = ''
for alpha in return_word:
  final += alpha
print(final)

Submission status: Accepted

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

right_dict = { chr(65 + i):i + 1 for i in range(26) }

s_list = [i for i in s]

new_list=[]
for word in s_list:
    num = right_dict[word]
    if num + n > 26:
        right_num = num + n -26
        for k,v in right_dict.items():
            if v == right_num:
                new_list.append(k)
    else:
        right_num = num + n
        for k,v in right_dict.items():
            if v == right_num:
                new_list.append(k)
print(''.join(new_list))

Submission status: Accepted

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

ans=""

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
d=''
for x in s:
    if (ord(x) + n )> ord('Z'):
        d = d + chr((ord(x) + n ) - 26)
    else:
        d = d + chr(ord(x) + n)
print(d)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
K = int(input())
def enc(k, m):
  plain = list(m.encode("ascii")) 
  cipher = plain.copy() 
  for i,code in enumerate(plain ):
    cipher[i] = cipher[i] + k
    if (cipher[i] > 90):
      cipher[i] = cipher[i] - 26      
  return(bytes(cipher ). decode("ascii"))
angobun = enc(K,input())
print(angobun)

Submission status: Accepted

Solution code:
import string
n=int(input())
s=input()
a=string.ascii_uppercase*2
ans=""
for i in s:
    ans+=a[a.index(i)+n]
print(ans)

Submission status: Accepted

Solution code:
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

N = int(input().strip())
def shifttext(shift):
    S = str(input('').upper())
    data = []
    for i in S:
        if i.strip() and i in alphabet:
            data.append(alphabet[(alphabet.index(i) + shift) % 26])
        else:
            data.append(i) 
    output = ''.join(data)
    return output
print(shifttext(N))

Submission status: Accepted

Solution code:
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' #use a string like this, instead of ord()
N = int(input().strip())
def shifttext(shift):
    S = str(input('').upper()) #Input text here
    data = []
    for i in S: #iterate over the text not some list
        if i.strip() and i in alphabet: #if the char is not a space ""
            data.append(alphabet[(alphabet.index(i) + shift) % 26])
        else:
            data.append(i) #if space the simply append it to data
    output = ''.join(data)
    return output
print(shifttext(N))

Submission status: Accepted

Solution code:
num = int(input())
S = str(input())
S2 = list(S)

for i in range (0,len(S)):
    tmp = ( ord(S[i]) - ord("A") + num ) % 26 + ord("A")   
    S2[i] = chr(tmp)
ans = "".join(S2)
print(ans)

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')))
            # nの符号で向き変更
        # no change for other characters
        else:
            ns.append(ch)
    return "".join(ns)

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

print(caesar(S, N))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
li_c =[]
li = ["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 x in s:
  c = li.index(x)
  c += n
  if c > 25:
    c -= 26
  print(li[c], end = "")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alphabet = [chr(i) for i in range(65, 65+26)]
result = ""
for char in s:
  idx = (alphabet.index(char) + n) % 26
  result += alphabet[idx]
print(result)

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
dic={"A":0,"B":1,"C":2,"D":3,"E":4,"F":5,"G":6,"H":7,"I":8,"J":9,"K":10,"L":11,"M":12,"N":13,"O":14,"P":15,"Q":16,"R":17,"S":18,"T":19,"U":20,"V":21,"W":22,"X":23,"Y":24,"Z":25}
di={1:"A",2:"B",3:"C",4:"D",5:"E",6:"F",7:"G",8:"H",9:"I",10:"J",11:"K",12:"L",13:"M",14:"N",15:"O",16:"P",17:"Q",18:"R",19:"S",20:"T",21:"U",22:"V",23:"W",24:"X",25:"Y",26:"Z"}
li=[]
t=len(s)
for i in range(0,t):
  k=s[i]
  m=dic[k]
  a=(m+n)%26+1
  b=di[a]
  li.append(b)
print("".join(li))

Submission status: Accepted

Solution code:
str_list = [chr(i) for i in range(65,65 + 26)]
n = int(input())
s = input()
new_s = []
for i in s:
    tmp = ord(i) + n if ord(i) + n < 65 + 26 else  (ord(i) + n) % (65 + 26) + 65 
    new_s.append(chr(tmp))
print(''.join(new_s))

Submission status: Accepted

Solution code:
def changeStr(num, charactor):
  sum = num + ord(charactor)
  if sum > 64 + 26 :
    return chr(sum - 26)
  else:
    return chr(sum)

inputStr = [input() for i in range(2)]
num = int(inputStr[0])
targetStr = inputStr[1]

for target in list(targetStr):
  print(changeStr(num, target), end="")

Submission status: Accepted

Solution code:
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' #use a string like this, instead of ord()
N = int(input().strip())
def shifttext(shift):
    S = str(input('').upper()) #Input text here
    data = []
    for i in S: #iterate over the text not some list
        if i.strip() and i in alphabet: # if the char is not a space ""
            data.append(alphabet[(alphabet.index(i) + shift) % 26])
        else:
            data.append(i) #if space the simply append it to data
    output = ''.join(data)
    return output
print(shifttext(N))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def caesar(s, n):
    ns = []
    for ch in s:
        ns.append(chr((ord(ch) - ord('A') + n) % 26 + ord('A')))
    return "".join(ns)

n = int(input())
s = str(input())
result = caesar(s, n)
print(result)

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
z=90
ans = []
# print(n,s)
# print([ord(i) for i in s])

for i in s:
    if ord(i)+n > z:
        ans.append(chr(ord("A") - (z-ord(i)-n)  -1))
    else:
        ans.append(chr(ord(i)+n))

# print([ord(i) for i in ans])
print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S = 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"]
A="ABCDEFGHIJKLMNOPQRSTUVWXYZ"

num=0
ans=""
for i in S:
    num=A.find(i) + N
    if num>25:
        num=num-26
    ans=ans+L[num]
print (ans)

Submission status: Accepted

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

dict = {'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}

def inverse_dict(d):
    return {v:k for k,v in d.items()}

i_dict = inverse_dict(dict)

for i in range(len(S)):
  print(i_dict[(dict[S[i]] + N) % 26], end="")

Submission status: Accepted

Solution code:
N = int(input())
str = [input() for i in range(1)]
STRING=str[0]
enc = ""

for i in list(STRING):
    ASCII = ord(i)
    num = ASCII - 65
    num = (num + N % 26)
    ASCII = num + 65
    if ASCII > 90:
        ASCII -= 26
    enc += chr(ASCII)
print(enc)

Submission status: Accepted

Solution code:
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
m = int(input())
list = input()
newlist = []
n = len(list)
for i in range(n):
	if int(alpha.find(list[i])) + m < 26:
		newlist.append(alpha[int(alpha.find(list[i])) + m])
	else:
		newlist.append(alpha[int(alpha.find(list[i])) + m -26]) 
moji = ''.join(newlist)
print(moji)

Submission status: Accepted

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

for i in range (0, len(S)):
    if ord(S[i]) + N <= 90:
        character.append(chr(ord(S[i]) + N))
    else :
        character.append(chr(ord(S[i]) + N - 89 +63))

answer = "".join(character)

print(answer)

Submission status: Accepted

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

A = list('ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ')
T =""
for i in S:
    k=A.index(i)+int(N)
    t=A[k]
    T +=t

print(T)

Submission status: Accepted

Solution code:
#import pysnooper
#import numpy
#import os,re,sys,operator
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement,permutations
from sys import stdin,setrecursionlimit
#from bisect import bisect_left
#from copy import deepcopy
#import heapq
#import math
import string
#from time import time
#from functools import lru_cache
setrecursionlimit(10**6)
input=stdin.readline

n=int(input().rstrip())
s=input().rstrip()
abc=string.ascii_uppercase*2
ans=""
for i in s:
    ans+=abc[abc.index(i)+n]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = list(str(input()))
result = ''
for i in range(len(s)):
  if ord(s[i]) + n <= 90:
    result += chr(ord(s[i]) + n)
  else:
    result += chr(ord(s[i]) + n - 26)
print(result)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
S = [i for i in s]
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i, value1 in enumerate(S):
    for j, value2 in enumerate(a):
        if value1 == value2:
            if j+n >= len(a):
                S[i] = a[j+n-len(a)]
                break
            else:
                S[i] = a[j+n]
                break    
S = "".join(S)
print(S)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
S = input()

# ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

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

print(ans)