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:
import string
alpha = list(string.ascii_uppercase)
N = int(input())
S = input()
ans = ""
for i in range(len(S)):
    index = alpha.index(S[i])
    num =(index + N) % 26
    ans += str(alpha[num])
print(ans)

Submission status: Accepted

Solution code:
abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"


def map_abc(N, S):
    result = ""
    for str_a in S:
        new_index = (abc.find(str_a) + N) % 26
        new_str = abc[new_index]
        result = result + new_str
    return result


if __name__ == "__main__":
    N = int(input())
    S = input()
    print(map_abc(N, S))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
arr = "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".upper().split()
arr = arr[:] + arr[:] + ["A"]

sol = []
for t in s:
    for i in range(26):
        if t == arr[i]:
            sol.append(arr[i+n])
            break
        
print("".join(sol))

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
 
alpha = lambda c:ord(c) - ord('A') + 1
num2alpha = lambda c: chr(c+64)

answer = ''
for i in S:
  num = alpha(i) + N
  if num >= 27:
    num -= 26
  answer += num2alpha(num)

print(answer)

Submission status: Accepted

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

ref = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

result = []
for s in S:
    tmp = (ref.index(s) + N) % 26
    result.append(ref[tmp])

print(''.join(result))

Submission status: Accepted

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

ans=''
for i in range(len(S)):
    if ord(S[i])+N-90>0:
        ans+=chr(ord(S[i])+N-26)
    else:
        ans+=chr(ord(S[i])+N)
print(ans)

Submission status: Accepted

Solution code:

#ord("A") = 65
#ord("Z") = 90
n = int(input())
s = list(input())
ans = ""

for c in s:
    now = ord(c) - 65
    changed = (now + n) % 26
    ans += chr(changed + 65)
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
key = int(input())
plain = str(input())
enc=""

for char in list(plain):
    asci = ord(char)
    num = asci - 65
    num = (num + key) % 26
    asci = num + 65
    enc += chr(asci)

print(enc)

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

for i in range(len(s)):
  for j in range(26):
    if s[i] == alphabets[j]:
      out += alphabets[(j+n)%26]
      break

print(out)

Submission status: Accepted

Solution code:
n=int(input())
a={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"}
s=input()
def inverse_lookup(a, x):
    for k,v in a.items():
        if x == v:
            return k
for x,i in enumerate(s):
    ind=inverse_lookup(a,i)
    ind+=n
    if ind>=26:
        ind-=26
    print(a[ind],end="")

Submission status: Accepted

Solution code:
n =int(input())
s = list(str(input()))
l = []

for i in range(len(s)):
  t = ord(s[i])
  a = t+n
  if a >= 91:
    a = a-26
  l.append(a)
m =[]
for j in range(len(l)):
  b = chr(l[j])
  m.append(b)
print(''.join(m))

Submission status: Accepted

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

for w in S:
    ch = chr(ord("A") + (ord(w)-ord("A")+N) % 26)
    print(ch, end="")

Submission status: Accepted

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

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

Submission status: Accepted

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

# 0~25
alph = [chr(i) for i in range(65, 65+26)]

new_string = []
for c in S:
  idx = alph.index(c) + N
  if idx >= 26:
    idx -= 26
  new_string.append(alph[idx])

print("".join(new_string))

Submission status: Accepted

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

num_to_alphabet = {
    "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",
}


alphabet_to_num = {
  "A": "1",  
  "B": "2",  
  "C": "3",  
  "D": "4",  
  "E": "5",  
  "F": "6",  
  "G": "7",  
  "H": "8",  
  "I": "9",  
  "J": "10",
  "K": "11",
  "L": "12",
  "M": "13",
  "N": "14",
  "O": "15",
  "P": "16",
  "Q": "17",
  "R": "18",
  "S": "19",
  "T": "20",
  "U": "21",
  "V": "22",
  "W": "23",
  "X": "24",
  "Y": "25",
  "Z": "26",
}
answer = ""
for s in S:
    if int(alphabet_to_num[s])+N <= 26:
        answer += num_to_alphabet[str(int(alphabet_to_num[s])+N)]
    else:
        answer += num_to_alphabet[str(int(alphabet_to_num[s]) + N - 26)]

print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ss = input()
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" * 2
print("".join([alphabet[alphabet.index(s) + n] for s in ss]))

Submission status: Accepted

Solution code:
i = int(input())
s = input()
l = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
r = ''
for k in s:
    cd = l.index(k) + i
    if cd > 25:
        cd -= 26

    r += l[cd:cd + 1]
print(r)

Submission status: Accepted

Solution code:
from string import ascii_uppercase as ups
n = int(input())
S = input()
print(''.join(ups[ups.index(ch) + n - 26] for ch in S))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
l = len(s)
ans = []
answer = ""

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

for i in range(l):
    a = s.pop(0)
    b = int(alist.index(a))
    c = b + n
    d = alist[c]
    ans.append(d)
    
for x in ans:
    answer += x

print(answer)

Submission status: Accepted

Solution code:
n = int(input())

a_ascii = ord("A")
z_ascii = ord("Z")
range_ascii = z_ascii - a_ascii + 1
s = list(map(lambda x: ord(x) - a_ascii, list(input())))
s = list(map(lambda x: x + n, s))

for i in range(len(s)):
    if (s[i] - range_ascii) >= 0:
        s[i] = abs(s[i] - range_ascii)

s = list(map(lambda x: chr(x + a_ascii), s))

print("".join(s))

Submission status: Accepted

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

alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
result = []

for char in S:
  idx = alphabets.index(char)
  idx += N
  if idx < len(alphabets):
    result.append(alphabets[idx])
  else:
    result.append(alphabets[idx - len(alphabets)])

print(''.join(result))

Submission status: Accepted

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

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

for i in S:
    j = ord(i)-ord("A")
    if j + N >= 26:
        j -= 26
    A.append(L[j+N])

print(''.join(A))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for char in s:
    after = ord(char) + n
    if after > 90:
        after -= 26
    ans += chr(after)

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=str(input())
s=list(S)
t=['']*len(s)
#print(len(s))
#print(t)
for i in range(len(s)):
    if ord(s[i])+N>90:
        t[i]=chr(ord(s[i])+N-26)
        #print(s[i])
    else:
        #print(s[i])
        t[i]=chr(ord(s[i])+N)
A=''.join(t)
print(A)

Submission status: Accepted

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

def char2ascii(char):
    return ord(char)
    
def ascii_ope(ascii, num):
    pre_ascii = ascii + num
    if pre_ascii > 90:
        pre_ascii = pre_ascii - 26
    return pre_ascii

pre_str=''
for char in S:
    ascii = char2ascii(char)
    pre_ascii = ascii_ope(ascii, N)
    # print(pre_ascii, type(pre_ascii))
    pre_char = chr(pre_ascii)
    pre_str += pre_char
    

print(pre_str)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def hen(c):
    for i in range(26):
        if c == al[i]:
            return al[(i+n) % 26]
print("".join([hen(c) for c in s]))

Submission status: Accepted

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

def caesar_encrypt(realText, step):
    outText = ""
    cryptText = []

    uppercase = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
                 'U', 'V', 'W', 'X', 'Y', 'Z']
    for eachLetter in realText:
        index = uppercase.index(eachLetter)
        crypting = (index + step) % 26
        cryptText.append(crypting)
        newLetter = uppercase[crypting]
        outText+=newLetter
    return outText
  
print(caesar_encrypt(s,n))

Submission status: Accepted

Solution code:
import string
slice_num = int(input())
string_dic = list(input())

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




for i in range(len(string_dic)):
    string_dic[i] = omoji[(omoji.index(string_dic[i])+slice_num)%26]


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def f(c, n):
  code = ord(c)
  code += n
  if code > ord('Z'):
    code -= 26
  return chr(code)

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

s2 = ''.join(list(map(lambda c: f(c,n), list(s))))

print(s2)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(int(1e6))

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

ans = ''
for s in S:
    m = ord(s) + N
    n = (m - ord("A")) % 26
    c = chr(ord("A") +n)
    ans = ans + c

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
S = input()
# alpha2num = lambda c: ord(c) - ord('A') + 1
moji_dict = {'A':1, 'B':2, 'C':3, 'D':4, 'E':5, 'F':6, 'G':7, 'H':8, 'I':9, 'J':10, 'K':11, 'L':12, 'M':13, 'N':14, 'O':15, 'P':16, 'Q':17, 'R':18, 'S':19, 'T':20, 'U':21, 'V':22, 'W':23, 'X':24, 'Y':25, 'Z':26}
num_dict = {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'}
for s in S:
    # print("'" + s + "'" + ":" + str(alpha2num(s)), end = ", ")
    # print(str(alpha2num(s)) + ":" + "'" + s + "'", end = ", ")
    res = moji_dict[s] + n
    if res > 26:
        print(num_dict[res - 26],end="")
    else:
        print(num_dict[res],end="")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
for i in range(len(s)):
    if (ord(s[i]) + n) > ord("Z"):
        print(chr(n + ord(s[i]) - ord("Z") + ord("A") - 1), end='')
    else:
        print(chr(ord(s[i]) + n), end='')

Submission status: Accepted

Solution code:
N = int(input())
S = input()
original_index = [ord(c) for c in S]
def trans(index, N):
    if index + N < (65 + 26):
        return chr(index + N)
    else:
        return chr(index + N - 26)

transformed = [trans(ind, N) for ind in original_index]
print("".join(transformed))

Submission status: Accepted

Solution code:
# B
N = int(input())
S = input()
enc = ""

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

def rot(s, n):
    c = (rot_n(c, n) for c in s)
    return ''.join(c)

print(rot(S, N))

Submission status: Accepted

Solution code:
import string

def shift_enc(message, n, cap=True):
    output_index = 0
    output = ""
    for chara in message:
        output_index = (string.ascii_uppercase.index(chara.upper()) + int(n)) % 26
        output += string.ascii_uppercase[output_index]
    if cap == False:
        output = output.lower()
    return output

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

print(shift_enc(S, N, True))

Submission status: Accepted

Solution code:
n = int(input())
x = str(input())
outp = []

word = {
        "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 w in x:
    new = (word[w] + n) % 26
    for key, value in word.items():
        if new == value:
            outp.append(key)

print("".join(outp))

Submission status: Accepted

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

for i in range(len(chars)):
  num = alp.index(chars[i])
  if n+num>=26:
      num -= 26
  nalp.append(alp[n+num])

mojiretu = ''
 
for x in nalp:
    mojiretu += x
print(mojiretu)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
pos_A = ord('A')

res = list(map(lambda x: chr(pos_A + (ord(x) - pos_A + N) % 26), S))

print(''.join(res))

Submission status: Accepted

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

result = []

for s in S:
    result.append(chr(ord(s)+N))

for r in result:
    if ord(r) >= 91:
        print(chr(ord(r)-26), end="")
    else:
        print(r, end="")

Submission status: Accepted

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

ans = ''
for c in s:
    tmp_i = ord(c) - ord('A')
    if tmp_i + n < 26:
        ans+=chr(ord(c)+n)
    else:
        ans+=chr(ord('A')+(n-(ord('Z')-ord(c)))-1)
    
print(ans)

Submission status: Accepted

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

enc = ""

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

print(enc)

Submission status: Accepted

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

for l in s:
    tmp = ord(l)
    tmp += n
    # print(l, tmp)
    if not (65 <= tmp <= 90):
        tmp -= 26

    # print(tmp, chr(tmp))
    print(chr(tmp), end="")
print("")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
arr = {'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':0}
arr2 = {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', 0:'Z'}
ans = ''
for i in s:
    ans += arr2[(arr[i] + n) % 26]
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
s_lst=[]
s_dic={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'}

for s in S:
    for k,d in s_dic.items():
        if s==d and k+N<=25:
            buf=s_dic[k+N]
            s_lst.append(buf)
            break
        elif s==d and k+N>25:
            buf=s_dic[k+N-26]
            s_lst.append(buf)
            break
v=''
for s in s_lst:
    v+=s
print(v)

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
A=''
for i in S:
    if ord(i)+N<=ord('Z'):
        A+=chr(ord(i)+N)
    else:
        A+=chr(ord(i)+N-(ord('Z')-ord('A')+1))
print(A)

Submission status: Accepted

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

    ns = []
    for ch in s:
        ns.append(chr((ord(ch) - ord('A') + n) % 26 + ord('A')))
        

    print("".join(ns))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    s=input()
    ans=[]
    # print(ord('A'))
    # print(ord('Z'))
    # print(chr(90))
    for i in range(0,len(s)):
        if ord(s[i])+n <= 90:
            tmp=int(ord(s[i]) + n)
            ans.append(chr(tmp))
        else:
            tmp=int(90-ord(s[i])-n)
            tmp2=-1*tmp+64
            ans.append(chr(tmp2))
    for i in range(0,len(ans)):
        print(ans[i],end='')
    print('\n')

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
shiftCount = int(input())
s = input()
s = s[:]
answer = ""

for i in s :
    AsciiCode = ord(i) + shiftCount
    if AsciiCode > 90 :
        AsciiCode -= 26
    answer += chr(AsciiCode)

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
S = [str(x) for x in input()]
alpha_list = [chr(ord('A') + i) for i in range(26)] * 2
for i in range(len(S)):
    S[i] = alpha_list[alpha_list.index(S[i]) + N]
ans = ''.join(S)
print(ans)

Submission status: Accepted

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

import sys
import math

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])
    s = lines[1]

    return (n, s)


def solve(n, s):

    ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    
    m = dict([(e, i) for i, e in enumerate(ch)])

    result = []
    for c in s:
        k = m[c] + n
        r = k % 26
        result.append(ch[r])

    return  "".join(result)


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Submission status: Accepted

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

for letter in S:
    result += chr((ord(letter) - 65 + N) % 26 + 65)

print(result)

Submission status: Accepted

Solution code:
N=int(input())
S=list(map(str,input()))
for i in range(len(S)):
  if ord(S[i])+N>90:
    S[i]=chr(ord(S[i])+N-26)
  else:
    S[i]=chr(ord(S[i])+N)
print("".join(map(str,S)))

Submission status: Accepted

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

C = ""

for i in range(len(S)):
  num = ord(S[i]) + N
  if num >= 91:
    num = num - 26
  C += chr(num)
  
print(C)

Submission status: Accepted

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


word_list = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA'

new_list = ''
for i in S:
	fd = word_list.find(i)
	new_list += word_list[fd + N]
	
print(new_list)

Submission status: Accepted

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

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

ans = []
for ss in s:
    ind = l.index(ss) + 1
    n_ind = ind + n
    r = n_ind % 26 - 1
    ans.append(l[r])

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
a = len(s)
ans = []
#a=65,b=66,z=90
for i in range(a):
    j = ord(s[i])
    j += n
    if j>90:
        j -= 26
    s = s[:i] + chr(j) + s[i+1:]
print(s)

Submission status: Accepted

Solution code:
import re

N = int(input())
S = input()
Answer = str()

for i in range(len(S)):
    Answer += chr(ord(S[i]) + N)
    if ord(Answer[i]) > ord("Z"):
        Answer = Answer[:-1] + chr(ord("A") + (ord(Answer[i]) - ord("Z")) - 1)
    
    
print(Answer)

Submission status: Accepted

Solution code:
import sys
n = int(input())
a = input()

for s in a:
  o = ord(s)+n
  if o > 90:
    o = o-26
  print(chr(o), end="")

Submission status: Accepted

Solution code:
num2alpha = lambda c: chr(c+65)
alpha2num = lambda c: ord(c) - ord('A')
N = int(input())
S = input()
new_S = str()
for i in range(len(S)):
    new_S = new_S + num2alpha((int(alpha2num(S[i]))+N)%26)
print(new_S)

Submission status: Accepted

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

def solve(s,K):
    alpha2num = lambda s: ord(s) - ord('A') + 1
    num2alpha = lambda num: chr(num+64)
    num  = alpha2num(s)
    try_num = (num+K)%26
    if try_num == 0:
        try_num = 26
    alpha = num2alpha(try_num)
    return alpha
output = []
for i in range(len(S)):
    output.append(solve(S[i],N))
print(''.join(output))

Submission status: Accepted

Solution code:
n=int(input())
a=input()
a=a.lower()
enc=""
for i in list(a):
    ASCII=ord(i)
    num=ASCII-97
    num=(num+n)%26
    ASCII=num+97
    enc+=chr(ASCII)
print(enc.upper())

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alphabet = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
alphabet_dicts = {}
for i, al in enumerate(alphabet):
    alphabet_dicts[al] = i
S_dush = alphabet[N:]+alphabet[:N]
ans = ""
for s in S:
    ans += S_dush[alphabet_dicts[s]]
print(ans)
print()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
x = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(len(s)):
    if x.index(s[i]) + n > 25:
        print(x[x.index(s[i]) + n - 26], end='')
    else:
        print(x[x.index(s[i]) + n], end='')

Submission status: Accepted

Solution code:

N = int(input())
words = list(input())

for i in range(len(words)):
    check_word  = ord(words[i]) + N 
    if(check_word > ord('Z')):
        print(chr(ord('A') + (check_word - ord('Z'))-1),end="")
    else:
        print(chr(check_word),end="")
print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    s=input()
    print(''.join(chr(ord('A')+(ord(c)-ord('A')+n)%26) for c in s))
    

main()

Submission status: Accepted

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

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

alfa = alfaA + alfaB

ans = []

for i in s:
    ans.append(alfa[alfa.index(i) + n])

print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
result = ""
for i in s:
   tmp = ord(i) + n
   
   if tmp > 90:
      tmp -= 26

   result += chr(tmp)


print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

L=[]
for i in range(len(s)):
    L.append((alpha2num(s[i])+n)%26)


for i in range(len(L)):
    if L[i]==0:
        L[i]=26
    L[i]=num2alpha(L[i])

print(''.join(L))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
st=""
n2=0
for i in range(len(S)):
  c1=S[i]
  n1=ord(c1)
  if n1+N>26:
    n2=(((n1-65)+N)%26)+65
  else:
    n2=n1
  st=st+chr(n2)
print(st)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
val=0
res=""
for i in range(len(s)):
  val=ord(s[i])
  val-=65
  val=(val+n)%26
  val+=65
  res+=chr(val)
print(res)

Submission status: Accepted

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

for char in list(S):
    ASCII = ((ord(char) - ord("A") + N) % 26) + ord("A")
    enc += chr(ASCII)
    
print(enc)

Submission status: Accepted

Solution code:

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

res=[]
for t in s:
	res.append(chr((ord(t)-ord("A")+n)%26+ord("A")))
print("".join(res))

Submission status: Accepted

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

ord_max = ord('Z')
for t in S:
    ord_t = ord(t)
    ord_t += N
    if ord_t > ord_max:
        ord_t -= 26
    print(chr(ord_t), end='')
print('\n')

Submission status: Accepted

Solution code:
#!/use/bin/env python3
n = int(input())
s = input()
for i in range(len(s)):
    print(chr((ord(s[i])-ord("A")+n)%26+65),end="")

Submission status: Accepted

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

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

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

ll = [0] * len(S)
for i in range(len(S)):
  b = 0
  b = alpha(S[i]) - 1
  b = (b + N) % 26
  c = num(b)
  ll[i] = c
  
print("".join(ll))

Submission status: Accepted

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

def _next(c, N):
    b = int.from_bytes(c.encode("utf-8"), "little") - 65
    return (b + N) % 26

def _decode(b):
    return (b + 65).to_bytes(1, "little")
    
ls = [_decode(_next(s, N)).decode("utf-8") for s in S]

print("".join(ls))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
t = ''
abc = [chr(i) for i in range(65, 65+26)]
for i in s:
  m = abc.index(i)
  if m+n <= 25:
    t += abc[m+n]
  else:
    t += abc[m+n-26]
print(t)

Submission status: Accepted

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

n = int(input())
S = list(input())

for i in range(len(S)):
    a = alpha2num(S[i])
    a += n
    a %= 26
    if (a==0):
        a=26
    S[i] = num2alpha(a)

print(''.join(S))

Submission status: Accepted

Solution code:
N = int(input())
# 平文
PLAIN = input()
PLAIN = PLAIN.lower()
# 秘密鍵
KEY = N

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

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

print(enc.upper())

Submission status: Accepted

Solution code:
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"]
n=int(input())
S=list(input())
for s in S:
    i=al.index(s)
    #print(i)
    print(al[(i+n)%26],end="")

Submission status: Accepted

Solution code:
n=int(input())
s=input()
a="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def func(x):
  c=a.find(x)
  return a[(c+n)%26]
t=""
for i in range(len(s)):
  t+=func(s[i])
print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
S = input()
li = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"*10
dic = {}
for i in range(26):
    dic[li[i]] = i
re = []
for i in range(len(S)):
    re.append(li[dic[S[i]]+N])
print("".join(re))

Submission status: Accepted

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

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

print(t)

Submission status: Accepted

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

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

for s in result:
    print(s, end="")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
n = n % (ord('Z') - ord('A') + 1)
ans = ''
for i in s:
    if ord(i) + n > ord('Z'):
        ans += chr(ord(i) + n - (ord('Z') - ord('A') + 1))
    else:
        ans += chr(ord(i) + n)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
new_S = ""
for alphabet in S:
    if ord(alphabet) + N > ord("Z"):
        new_S = new_S + chr(ord("A")-1+(ord(alphabet) + N - ord("Z")))
    else:
        new_S = new_S + chr(ord(alphabet) + N)
print(new_S)

Submission status: Accepted

Solution code:
a = int(input())
b = input() 
def caesar(s, n):
    ns = []
    for ch in s:
        if ('A' <= ch and ch <= 'Z'):
            ns.append(chr((ord(ch) - ord('A') - n) % 26 + ord('A')))
        else:
            ns.append(ch)
    return "".join(ns)

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

Submission status: Accepted

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

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
a = list(a)
answer = []
for i in range(len(S)):
  num = a.index(S[i])
  num_next = (num+N)%26
  answer.append(a[num_next])
answer = ''.join(answer)
print(str(answer))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
T=""
if S.isalpha() and S.isupper() and 1 <= len(S) <= 100000 and 0 <= N <= 26:
    for i in range(len(S)):
       T += chr(( ord(S[i]) - ord("A") + N ) % 26 + ord("A"))
    print(T)