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()

mod = ord("Z") - ord("A")

for i in range(len(s)):
    c = ord(s[i]) - ord("A")
    c += n
    c %= mod + 1
    print(chr(c + ord("A")),end = "")
print()

Submission status: Accepted

Solution code:
n = int(input())
#map(int,input().split())
s = list(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"]
for i in range(len(s)):
  index = alpha.index(s[i])
  index += n
  if index > 25:
    index -= 26
    s[i] = alpha[index]
  else:
    s[i] = alpha[index]
print("".join(s))

Submission status: Accepted

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

alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' * 2
conv = dict(zip(alphabet[:26], alphabet[N: N + 26]))
print(''.join([conv[c] for c in S]))

Submission status: Accepted

Solution code:
def changeAlph(x: str):
    after_num = ord(x) + n

    if after_num > 90:
        after_num -= 26

    return chr(after_num)


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

afterS = list(map(changeAlph, s))

print("".join(afterS))

Submission status: Accepted

Solution code:
letters = [chr(ord('A') + i) for i in range(26)]
n = int(input())
s = input()
new_s = ""
for letter in s:
  new_idx = (letters.index(letter) + n) % 26
  new_s += letters[new_idx]

print(new_s)

Submission status: Accepted

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

Submission status: Accepted

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

lch = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
dch = {}
ans = []

for i in range(len(lch)):
    dch[lch[i]] = i

for j in range(len(s)):
    ch = s[j]
    k = (dch[ch] + n) % 26
    ans.append(lch[k])

print("".join(ans))

Submission status: Accepted

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

alphabets = 'abcdefghijklmnopqrstuvwxyz'.upper()

for letter in S:
    index = alphabets.index(letter)
    if index + N > 25:
        new_index = index + N - 26
    else:
        new_index = index + N

    print(alphabets[new_index], end='')

Submission status: Accepted

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

new_s_list = [chr(ord(i)+N) if ord(i)+N <= 90 else chr(ord(i)+N-26) for i in s]

print("".join(new_s_list))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
li='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N=int(input())
S=str(input())
ans=''
for i in range(len(S)):
  for j in range(len(li)):
    if S[i]==li[j]:
      if j+N<len(li):
        num=j+N
        ans+=li[num]
      elif j+N>=len(li):
        num=j+N-len(li)
        ans+=li[num]
print(ans)

Submission status: Accepted

Solution code:
N=int(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"]
S=list(input())
l2=l[N:]+l[:N]
for i in range(len(S)):
  j=l.index(S[i])
  S[i]=l2[j]
ans="".join(S)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
for moji in s:
    o = ord(moji) + n
    if 90 < o:
        o = o -26
    print(chr(o), end="")

Submission status: Accepted

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

N %= 26

for s in S:
    o = ord(s) + N
    if o > ord('Z'):
        o = ord('A') + (o - ord('Z')) - 1
    print(chr(o), end="")
print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 2019-11-24 20:59:47(JST)
import sys
# import numpy as np
from string import ascii_uppercase as alphabet

alphabet = alphabet[-1] + alphabet[0:]

alpha_num = enumerate(alphabet, 0)

alpha_num = dict((alpha, num) for num, alpha in alpha_num)

def main():
    n, s = sys.stdin.read().split()
    n = int(n)

    t = ''
    for c in s:
        t += alphabet[(alpha_num[c] + n) % 26]
    
    print(t)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

out = ''

for ss in s:
  for j,aa in enumerate(a):
    if ss == aa:
      out += a[(j+n) % 26]

print(out)

Submission status: Accepted

Solution code:
ALPHABET = range(ord('A'), ord('Z') + 1)


def enc(k, m):
    # """enc(秘密鍵 k, 平文 m) = 暗号文 c"""
    hira = list(m.encode("ascii"))  # 文字列から文字コードの配列へ変換
    ango = hira.copy()  # 暗号文（のコード）格納用配列
    for i, code in enumerate(hira):
        offset = code - ALPHABET[0]  # 文字 a からの差分
        if 0 <= offset <= ALPHABET[-1]-ALPHABET[0]:  # 英小文字ならば …
            offset += k
            offset %= len(ALPHABET)
        ango[i] = offset + ALPHABET[0]  # 暗号文用のコードの格納
    c = bytes(ango).decode("ascii")  # コードの配列を文字列に直す
    return c


n = int(input())
s = input()
angobun = enc(n, s)
print(angobun)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000)
def solve():
  n = int(input())
  s = input()
  ans = ""
  for i in range(len(s)):
    temp = 0
    if ord(s[i])+n > 90:
      temp = 26
    ans += chr(ord(s[i])+n-temp)
  print(ans)
solve()

Submission status: Accepted

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

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

Submission status: Accepted

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

# 平文
PLAIN = S

# 秘密鍵
KEY = N

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

for c in list(PLAIN):
    ASCII = ord(c)
    # print(ASCII)
    num = ASCII - 65
    num = (num + KEY) % 26
    ASCII = num + 65
    enc += chr(ASCII)

print(enc)

Submission status: Accepted

Solution code:
n = int(input())
S = [chr((ord(s)-65+n)%26+65) for s in input()]

print(*S, sep='')

Submission status: Accepted

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

result = ""

for c in S:
    result = result + chr(abs(((ord(c) + n - ord('A')) % 26)) + ord('A'))

print(result)

Submission status: Accepted

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

for c in S:
    n = ord(c) + N
    if n > 90:
        R += chr(n - 26)
    else:
        R += chr(n)

print(R)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
U=''
for i in range(len(S)):
    if ord(S[i]) + N<91:
        U+=chr(ord(S[i]) + N)
    else:
        U+=chr(ord(S[i])+N-90+64)
print(U)

Submission status: Accepted

Solution code:
import string
upper = string.ascii_uppercase
upper *= 2

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

print(''.join(upper[upper.index(s) + N] for s in S))

Submission status: Accepted

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

ans = ''
for s in S:
    tmp = ord(s)
    if (tmp+N>=91):
        ans+= chr(tmp+N-91+65)
    else:
        ans+=chr(tmp+N)

print(ans)

Submission status: Accepted

Solution code:
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n = INT()
s = input()

for i in s:
    ch = (ord(i) - ord("A") + n)%26 + ord("A")
    print(chr(ch),end="")
print()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# A to Z: 65 to 90
N = int(input())
S = input()

r = []
for c in S:
  t = ord(c) + N
  if t >= 91:
    t -= 26
  r.append(chr(t))
print(''.join(r))

Submission status: Accepted

Solution code:
rot = int(input())
text = input()

text_int = [ord(x)+rot for x in text]
output = [chr(x) if x <= 90 else chr(x-26) for x in text_int]
print("".join(output))

Submission status: Accepted

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

ans = ''
for i in S:
    curidx = letters.index(i) + N
    ans += letters[curidx]
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math


n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
res = ''
for el in s:
    tmp = (ord(el)-65+n) % 26
    res += chr(tmp+65)

print(res)

Submission status: Accepted

Solution code:
import string
N = int(input())
S = input()
alp = [_ for i in range(2) for _ in string.ascii_uppercase]
ans = ""
for i, s in enumerate(S):
    ans += alp[alp.index(s) + N]

print(ans)

Submission status: Accepted

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

    ans = ""

    for ch in S:
        code = ord(ch) + N
        if code > ord('Z'):
            code -= 26
        ans += chr(code)
        
    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
#!python3.4.3

temp = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') # len: 26
n = int(input())
s = list(input())
result = ''

for c in s:
    index = temp.index(c)
    if index + n < len(temp):
        result += temp[index + n]
    else:
        result += temp[(len(temp) - (index + n)) * -1]
print(result)

Submission status: Accepted

Solution code:

n = int(input())
s = input()
# 26(25)
tmp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

a_L = [val for val in tmp]
ans = ""
for val in s:
    i = a_L.index(val)
   
    if i+n >= 26:
        aa = i+n - 26
        #print("aaaa") 
    else:
        aa = i + n
    #print(aa)
    ans += a_L[aa]
print(ans)
#a,b = map(int,input().split())
#a_L = map(int,input().split())

Submission status: Accepted

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

alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

C = ''

for i in range(len(S)):
    index = alpha.find(S[i])
    index = (index+N)%26

    C += alpha[index]

print(C)

Submission status: Accepted

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

T = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
S2 = list(S)
T2 = list(T)

for i in range(len(S)):
    S2[i] = T2[int(T2.index(S2[i]) + N)]
print(''.join(S2))

Submission status: Accepted

Solution code:
N = ord('A')
M = ord('Z')

n = int(input())
S = input()
T = ""
for c in S:
    a = ord(c) + n 
    if a > M:
        a = a - M + N - 1
    T += chr(a)
    

print(T)

Submission status: Accepted

Solution code:
# coding : utf-8

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

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

for i in range(len(S)):
    if(ord(S[i])+N <= 90):
        print(chr(ord(S[i])+N), end="")
    elif(ord(S[i])+N > 90):
        print( chr( 65 + N - (91-ord(S[i])) ), end="" )

Submission status: Accepted

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

for i in range(len(a)):
    a[i] = chr((ord(a[i]) + n - 65) % 26 +65)

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

Submission status: Accepted

Solution code:
n=int(input())
s=list(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"]
c=[]
for i in s:
    h=d.index(i)
    h=h+n
    if h>=26:
        h=h-26
    c.append(d[h])
print("".join(c))

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
ans = ""
abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(len(S)):
    for j in range(len(abc)):
        if S[i] == abc[j]:
            ans += abc[(j+N)%26]
            break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
xyz = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#print(xyz[2])
for ch in s:
    #print("ch",ch)
    #print(xyz.find(ch))
    #print(xyz.find(ch)+n+1)
    if xyz.find(ch)+n+1 > len(xyz):
        print(xyz[xyz.find(ch)+n-len(xyz)],end = "")
    else:
        print(xyz[xyz.find(ch)+n],end = "")

print("")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
S = input()
rot = ""
for i in range(len(S)):
	rot += chr((ord(S[i]) - ord('A') + n) % 26 + ord('A'))
print(rot)

Submission status: Accepted

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

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" * 2
s = ""
for i in S:
    for j in range(len(a)):
        if i == a[j]:
            s += a[j+N]
            break
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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


print("".join(ans).upper())

Submission status: Accepted

Solution code:
# 2019/11/24

n=int(input())
s=input()
ans=[chr((ord(e)-65+n)%26+65) for e in s]
print(''.join(ans))

Submission status: Accepted

Solution code:
def getConverseCodes(args, n):
    converseCodes = ''
    for s in args:
        #アスキーコードに変換
        s = ord(s)
        s = s + n
        if s > 90:
          s = s - 26
        #アスキーコードから文字を取得
        s = chr(s)
        converseCodes += s
    return converseCodes

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

print(getConverseCodes(S, N))

Submission status: Accepted

Solution code:
N=int(input())
S=str(input())
M=len(S)
T=''
Al='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(M):
  for j in range(26):
    if S[i]==Al[j]:
      T +=str(Al[j+N])
      break
print(T)

Submission status: Accepted

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

alf = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

res = ''

Slen = len(S)

for i in S:
    fd = alf.find(i)
    res += alf[(fd+N)%26]

print(res)

Submission status: Accepted

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

ans = str()

for s in S:
    if ord(s) + N > 90:
        ans += chr(ord('A') + N - (91-ord(s)))
    else:
        ans += chr(ord(s) + N)

print(ans)

Submission status: Accepted

Solution code:

n = int(input())
s = input()
total = ""
for i in s :
  i = ord(i)+n
  if 65+26 <= i : i = i-26
  total += chr(i)

print(total)

Submission status: Accepted

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

key = N
enc = ""

for char in list(S):
    ascii = ord(char)
    num = ascii - ord('A')
    num = (num + key) % 26
    ascii = num + ord('A')
    enc += chr(ascii)

print(enc)

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
ss = input()
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']
ans = ''
for s in ss:
  ind = al.index(s)
  if ind + n >= 26:
    ans += al[ind + n - 26]
  else:
    ans += al[ind + n]
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
s=input()
output = []
for cha in s:
    number = ord(cha) 
    number += N
    if(number > 90):
        number -= 26
    output_ = chr(number)
    print(output_,end="")

Submission status: Accepted

Solution code:
import sys
if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

N = int(input())
S = input().rstrip()

ans = []
for s in S:
	if alphabet.find(s) > (25-N):
		ans.append(alphabet[alphabet.find(s)-(26-N)])
	else:
		ans.append(alphabet[alphabet.find(s)+N])

print(''.join(ans))

Submission status: Accepted

Solution code:
n=int(input())
s=input()
al=[chr(i) for i in range(65,65+26)]
n_list=[]
for i in s:
    n_list.append((al.index(i)+n)%26)

for i in n_list:
    print(al[i],end="")

Submission status: Accepted

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


abc = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
abc_map = {}
for i, c in enumerate(abc):
    abc_map[c] = i

sb = ''
for n in list(S):
    i = (abc_map[n] + N) % len(abc)
    sb += abc[i]

print(sb)

Submission status: Accepted

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

alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
result = ""
for s_ in s:
  index = alpha.find(s_)
  i = n + index
  if i >= len(alpha):
    i -= len(alpha)
  result += alpha[i]
print(result)

Submission status: Accepted

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

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

tmp = ""
for val in S:
    tmp += num2alpha((alpha2num(val)+N)%26)
print(tmp)

Submission status: Accepted

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


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


print(caesar(S, -N))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = input().rstrip()


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

ans = []
for x in S:
    i = alphabet.index(x)
    if i + N >= 26:
        ans.append(alphabet[i+N-26])
    else:
        ans.append(alphabet[i+N])

print(*ans, sep='')

Submission status: Accepted

Solution code:
n = int(input()) % 26
s = input()
res = ''
for i in s:
    if i.islower():
        c = chr(ord(i) + n)
        res += c if c.islower() else chr(ord(c) - 26)
    elif i.isupper():
        c = chr(ord(i) + n)
        res += c if c.isupper() else chr(ord(c) - 26)
    else:
        res += i
print(res)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
al = [chr(i) for i in range(65, 91)]

ss = []
for i in range(len(s)):
	if n + ord(s[i]) - 65 < 26:
		ss.append(al[n + ord(s[i]) - 65])
	else:
		ss.append(al[n + ord(s[i]) - 91])
print("".join(map(str,ss)))

Submission status: Accepted

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

Ans=[]
for i in S:
    Ans.append(Alphabet[(Alphabet.index(i)+N)%26])
print("".join([str(n) for n in Ans]))

Submission status: Accepted

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

ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
new = []
for c in S:
    for i in range(27):
        if c == ALPHA[i]:
            new.append(ALPHA[(i + N) % 26])
            break

print(''.join(new))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
A_1 = ["Z","Y","X","W","V","U","T","S","R","Q","P","O","N","M","L","K","J","I","H","G","F","E","D","C","B","A"]
A_2 = {}
for i in range(len(S)):
    S[i] = A_1[A_1.index(S[i])-N]
print(''.join(S))

Submission status: Accepted

Solution code:
import os
import numpy as np

class getStdin(object):
    @classmethod
    def get_int(cls):
        return int(input())

    @classmethod
    def get_str(cls):
        return str(input())


if __name__ == '__main__':
    n = getStdin.get_int()
    s = getStdin.get_str()
    ss = ''
    for i in range(len(s)):
        x = ord(s[i]) + n
        if x >= 91:
            x = x - 26

        ss += chr(x)

    print(ss)

    os.sys.exit(0)

Submission status: Accepted

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

x_lst = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

ans = []

for s in S:
    for i, x in enumerate(x_lst):
        if x == s:
            ans.append(x_lst[(i+N)%26])
print(''.join(ans))

Submission status: Accepted

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

a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

def find_alp(c, n):
    index = a.find(c)
    if index + n > 25:
        return a[index + n - 26]
    else:
        return a[index + n]

for j, c in enumerate(s):
    s[j] = find_alp(c, n)

print("".join(s))

Submission status: Accepted

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

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

for i in range(len(S)):
    index = alpha.index(S[i]) + N
    if index > 25:
        index -= 26
    S[i] = alpha[index]

print("".join(S))

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
S =list(input())
ans = []
for i in S:
    tmp = ord(i)
    tmp += N
    if tmp > 90:
        tmp -= 26
    ans.append(chr(tmp))
print("".join(ans))

Submission status: Accepted

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

S_num = []
S_ans = []

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

for i in range(len(S)):
    tmp = alpha2num(S[i]) + N
    if int(tmp) >= 27:
        tmp = int(tmp) - 26
    
    S_num.append(tmp)

for t in range(len(S)):
    S_ans.append(num2alpha(S_num[t]))

print("".join(S_ans))

Submission status: Accepted

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

alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

list_S = list(S)
for i in range(len(list_S)):
    alpha_before = alphabet.index(list_S[i])
    alpha_after = (alpha_before + N) % 26
    list_S[i] = alphabet[alpha_after]

print(''.join(list_S))

Submission status: Accepted

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

for a in s:
    i = ord(a) + n
    i = i * (i <= 90) or i - 26
    print(chr(i), end='')
print()

Submission status: Accepted

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

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


num2alpha = lambda c: chr(c+64)

num2alpha(3) #==> C 

ans = []

for i in range(len(s)):
    #print(alpha2num(s[i])+n,(alpha2num(s[i])+n)%26)
    if (alpha2num(s[i])+n) % 26 == 0:
        ans.append(num2alpha(26))
        continue
    ans.append(num2alpha((alpha2num(s[i])+n)%26))
    
print(*ans,sep='')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
alp = [chr(i) for i in range(65, 65+26)] * 2

for i in range(len(s)):
    s[i] = alp[alp.index(s[i]) + n]
print(*s,sep="")

Submission status: Accepted

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

for i in range(len(S)):
  

  ord_ch = ord(S[i])
  ord_ch += N
  if ord_ch > ord('Z'):
    ord_ch -= 26
  S[i] = chr(ord_ch) 
print(*S, sep='')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

import string

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

    alf = string.ascii_uppercase

    out = ""
    for s in S:
        ind = alf.find(s)
        out += alf[(ind + N) % len(alf)]
    
    print(out)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
 
str = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
alist = list(str)
#print(s)
m=0
ans = ""
for i in s:
  ans += alist[alist.index(i) + n]
print(ans)

Submission status: Accepted

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

def rot(n):
  if n>26:
    return n-26
  else:
    return n

ans =''
for i in S:
  ans  = ans+num2alpha(rot(alpha2num(i)+N))
  

print(ans)

Submission status: Accepted

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

def rot(c, n):
	new_c_ord = ord(c) + n
	if new_c_ord >= 91:
		new_c_ord -= 26
	return chr(new_c_ord)

res = ''.join([rot(c, n) for c in list(s)])

print(res)

Submission status: Accepted

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

alphabets = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

result = ''
for w in S:
    index = alphabets.index(w)
    index = (index + N) % 26
    result += alphabets[index]
print(result)

Submission status: Accepted

Solution code:

N = int(input())

encryptionStr = input()

excludeStr = ""

result = ""

SHIFT_COUNT = N

for c in encryptionStr :

    if excludeStr.find(c) != -1 :
        result = result + c
        continue


    if ord('a') <= ord(c) <= ord('z') :
        result = result + chr(abs(((ord(c) + SHIFT_COUNT - ord('a')) % 26)) + ord('a'))
    else :
        result = result + chr(abs(((ord(c) + SHIFT_COUNT - ord('A')) % 26)) + ord('A'))

print (result)

Submission status: Accepted

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


a = 65
z = 90

for i in range(len(S)):
        if (ord(S[i]) + N) > 90:
                S[i] = chr(((ord(S[i]) + N) - 91) + 65)
        else:
                S[i] = chr(ord(S[i]) + N)

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = [None]*(len(s))

for i in range(len(s)):
    ans[i] = abc[abc.index(s[i])+n-26]

print(''.join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
n = len(S)
ans = ''
for i in range(n):
    a = (ord(S[i])-65+N)%26
    a += 65
    b = chr(a)
    ans += b
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
s=input()
alphabet=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
ans=""
for i in range(len(s)):
    x=alphabet.index(s[i])
    ans+=alphabet[(x+n)%26]
print(ans)

Submission status: Accepted

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

after_words = []
for w in words:
    tmp_w = ord(w)
    tmp_w += num
    if tmp_w > 90:
        tmp_w -= 26
    after_words.append(chr(tmp_w))

print("".join(after_words))

Submission status: Accepted

Solution code:
from collections import defaultdict
def main():
    ls = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    dic_str = defaultdict(int)
    dic_num = defaultdict(str)
    for i,st in enumerate(ls):
        dic_str[i] = st
        dic_num[st] = i
    n = int(input())
    s = input()
    ans = ""
    for i in s:
        num = dic_num[i]
        if num+n>25:
            num -= 26
        ans = ans + str(dic_str[int(num)+n])
    print(ans)

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
s=input()
ans=""
for i in range(len(s)):
    ans+=chr((ord(s[i])+n-65)%26+65)
print(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']
ans=''
for i in range(len(s)):
     for l in range(len(L)):
         if s[i]==L[l]:
             ans += L[((l+n)%len(L))]
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

    alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

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

    print(ans)

Submission status: Accepted

Solution code:

n = int(input())
s = input()
s = list(s)
# print(s)
result = []

for char in s:
    # print(char)
    i = ord(char)
    i += n
    if i > 90:
        i -= 26
    afterchar = chr(i)
    result.append(afterchar)

print("".join(result))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
s = s[N:] + s[:N]
print(S.translate(str.maketrans("ABCDEFGHIJKLMNOPQRSTUVWXYZ", s)))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
ans=[]
for s in S:
    ans.append(chr(65+(ord(s) + N-65)%26 ))
k=""
for a in ans:
    k+=a

print(k)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    N = int(input())
    S = input()
    new_S = ''
    for i in range(len(S)):
        new_S += judgeChangeChara(S[i],N)
    print(new_S)
    

def judgeChangeChara(chr,N):
    alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    index = alphabet.find(chr)
    if index+N > 25:
        return alphabet[(index+N) - 26]
    else:
        return alphabet[index + N]


if __name__ == "__main__":
    main()

Submission status: Accepted

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

alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""

for i in range(len(S)):
    for j in range(26):
        if S[i] == alphabets[j]:
            if j + N < 26:
                ans += alphabets[j + N]
            else:
                ans += alphabets[j + N - 26]
            break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
moji = 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"]
new_moji = []
for i in range(len(moji)):
    new_moji.append(alphabet[alphabet.index(moji[i]) + n])
print("".join(new_moji))

Submission status: Accepted

Solution code:
# アルファベットをずらす数
SHIFT_COUNT = int(input())
# 暗号化する文字列
encryptionStr = input()
# 暗号化から除外する文字列
excludeStr = "{}_"
# 暗号化した文字列の結果を格納
result = ""

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

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

print (result)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
dst = []
for i in s:
    dst += chr((ord(i) - ord('A') + n) % 26 + ord('A'))
print(''.join(dst))

Submission status: Accepted

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

enc = ""

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

print(enc)

Submission status: Accepted

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

ans = ""
for str in S:
   tmp = ord(str) + N 
   if tmp >= 91: tmp -= 26
   ans += chr(tmp)

print(ans)

Submission status: Accepted

Solution code:

#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

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

    d=ord('Z')-ord('A') + 1

    for c in S:
        o = (ord(c)-ord('A')+N)%d + ord('A') 
        print(chr(o), end="")


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

# %%
# from atcoder_test import doTest
# doTest("abc146","b",main)