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:
s = input()

N = int(s)

s = input()

S = s

r = ''
for c in S:
    t = ord(c)
    t = t - 65 # A
    t = t + N
    t = t % 26
    r = r + chr(t+65)

print(r)

Submission status: Accepted

Solution code:
def change_c(n,x):
    id_ = ord(x) + n
    if id_>90:
        id_ = 64 + (id_-90)
    return chr(id_)

n=int(input())
s=input()
print("".join(change_c(n,c) for c in s))

Submission status: Accepted

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

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

change_list = []
for alpha in [i for i in S]:
    num = alpha2num(alpha)
    if num + N > 26:
        num = num + N - 26
    else:
        num = num + N
    change_list.append(num2alpha(num))

print(''.join(change_list))

Submission status: Accepted

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

for i in range(len(S)):
    S[i] = chr((ord(S[i]) + N - 65) % 26 + ord('A'))
print("".join(S))

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()
out = ''

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

print(out)

Submission status: Accepted

Solution code:
def solve(string):
    n, s = string.split()
    b = ord("A")
    return "".join([chr(((ord(_s) - b + int(n)) % 26) + b) for _s in s])


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
ans = []
abc = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q","r", "s", "t", "u", "v", "w", "x", "y", "z"]
for i in range(len(S)):
    for j in range(len(abc)):
        if S[i] == abc[j].upper():
            if j + N < 26:
                ans.append(abc[j + N])
            else:
                ans.append(abc[j + N -26])


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

Submission status: Accepted

Solution code:
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']

num = int(input())
letter = list(input())
for i in range(len(letter)):
    n = alphabet.index(letter[i])
    o = n + num
    if o > 25:
        letter[i] = alphabet[o - 26]
    else:
        letter[i] = alphabet[o]
print(''.join(letter))

Submission status: Accepted

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

base_num = ord('A')
for i, s in enumerate(S):
    S[i] = chr((ord(s) - base_num + N) % 26 + base_num)

print(''.join(S))

Submission status: Accepted

Solution code:
ALP=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#print(len(ALP))

N=int(input())
S1=list(input())

S2=[]
for s in S1:
  ind=ALP.index(s)
  S2.append(ALP[(ind+N)%26])
  
print("".join(S2))

Submission status: Accepted

Solution code:
if __name__ == '__main__':

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

	ans = ""
	for i in S:
		ans += A [ ( A.index(i) + N ) % 26 ]

	print(ans)

Submission status: Accepted

Solution code:
n = int(input())
b = list(str(input()))
ln = [chr(i) for i in range(65,65+26)]
#小文字ならば　[chr(i) for i in range(97,97+26)]
ans = []
for i in range(len(b)):
    for j in range(len(ln)):
        if b[i] ==  ln[j]:
            if (25 - j) >= n:
                ans.append(ln[j + n])
            else:
                ans.append(ln[j + n - 26])
print(''.join(ans))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
   n = input()
   data = list(input())
   for i in data:
      a = ord(i) + int(n)
      if a > ord("Z"):
         a = a + ord("A") - ord("Z") - 1
      print(chr(a),end = "")

if __name__==  "__main__":
   main()

Submission status: Accepted

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

stdata = [chr(s) for s in range(ord("A"),ord("Z") + 1)]
ans = []
for i in range(len(s)):
  ind = stdata.index(s[i])
  ind = (ind + n) % 26
  ans.append(stdata[ind])
for i in range(len(s)):
  print(ans[i],end="")

Submission status: Accepted

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

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

res = ''

for i in range(len(s)):
    if ord(s[i]) + N >= 65 + 26:
        res += chr(ord(s[i]) + N - 26)
    else:
        res += chr(ord(s[i]) + N)

print(res)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
A="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans=""
for i in S:
    ans+=A[A.index(i)+N]
print(ans)

Submission status: Accepted

Solution code:
s = int(input())
f = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in f:
  ans += a[a.index(i)+s]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in s:
    ans += a[a.index(i) + n]
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 s in S:
    ans.append(alphabet[(alphabet.index(s) + N) % 26])
print("".join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

i = 0
for j in S:
    S[i] = alphabets[(alphabets.index(j) + N) % 26]
    i += 1

print("".join(S))

Submission status: Accepted

Solution code:

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

S = list(S)

j = 0
for s in S:
    a = ord(s)
    for i in range(0, N):
        if chr(a) != 'Z':
            a = a + 1
            S[j] = chr(a)
        else:
            a = a - 25
            S[j] = chr(a)
    j = j + 1

S = ''.join(S)

print(S)

Submission status: Accepted

Solution code:
stringline=[]
addnum=int(input())
stringline=input()
for i in range(len(stringline)):
    if 'A' <= stringline[i] and stringline[i] <= 'Z':
        print(chr((ord(stringline[i]) - ord('A') + int(addnum)) % 26 + ord('A')),end="")

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S=[i for i in input().rstrip()]
    ans_list=[]
    for s in S:
        data = int(ord(s))+N
        if data >= 91:
            data = data -26
        ans_list.append(chr(data))
    print(''.join(ans_list))


#    for string in S:
#    print(string_list)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans = ''

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = ''

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

print(ans)

Submission status: Accepted

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

alpha = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

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

print(''.join(s))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, S: str):
    abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    print("".join([abc[(abc.index(c)+N) % 26] for c in S]))
    return


def main():

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

t = ""
for i in s:
    t += chr((ord(i) + n) % 65 % 26 + 65)

print(t)

Submission status: Accepted

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

t = ""
for i in s:
    x = ord(i) + n
    if x < 91:
        t += chr(x)
    else:
        t += chr(x - 26)

print(t)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
alp_list = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
s = input()
ans = ""
for i in s:
    ind = alp_list.index(i)
    upd_ind = ind + n
    if upd_ind >= 26 and n != 0:
        upd_ind -= 26
    ans += alp_list[upd_ind]

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alphabets = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") * 2
ans = []
for s in S:
    i = alphabets.index(s)
    ans.append(alphabets[i + N])
print("".join(ans))

Submission status: Accepted

Solution code:
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}
word_reverse={v: k for k, v in word.items()}
x=input()
y=input()
Ans=''
for i in y:
  if word[i]+int(x) > 25:
    z = (word[i]+int(x)) % 26
  else:z=word[i]+int(x)
  Ans=Ans+word_reverse[z]

print(Ans)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
ans=[]
def Cha(x, N):
    a=(ord(x)+N)%26
    if a in range(0,13):
        return(chr(a+78))
    if a in range(13, 26):
        return(chr(a+52))
for i in range(len(S)):
    ans.append(Cha(S[i], N))
print(''.join(ans))

Submission status: Accepted

Solution code:
import sys, os
import collections

MOD = 10 ** 9 + 7


alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def solve(input_stream):
  N = read_int(input_stream)
  S = input_stream.readline().strip()

  ans = ""
  for char in S:
    index = alphabet.find(char)
    ans += alphabet[ (index + N) % len(alphabet)]
  return [ans]

def read_ints(input_stream):
  return [i for i in map(int, input_stream.readline().strip().split())]

def read_int(input_stream):
  return int(input_stream.readline().strip())


if __name__ == "__main__":
    outputs = solve(sys.stdin)
    for line in outputs:
      print(line)

Submission status: Accepted

Solution code:
N = int(input())
S = str(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:
from functools import reduce


def do_code():
    rot = int(input())
    str = input()
    table = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    ans = reduce(lambda red, s: red + table[(table.index(s) + rot) % 26], str[:], "")
    print(ans)


if __name__ == '__main__':
    do_code()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

r = ''
for i in range(len(S)):
    r += chr(ord('A') + (((ord(S[i]) + N) - ord('A')) % 26))

print(r)

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 s in S:
  index = alphabet.index(s)
  new_index = index + N if index + N < 26 else index + N - 26
  ans += alphabet[new_index]
print(ans)

Submission status: Accepted

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

alfa = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
count = len(S)
for i in range(0, count, 1):
    cmd = alfa.find(S[i])
    ans += alfa[cmd + N]
print(ans)

Submission status: Accepted

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

def shift_char(ch, num):
  z_ord = ord('Z')
  num_ord = ord(ch) + num 
  if num_ord > z_ord:
    num_ord -= 26
  return chr(num_ord)

for i in range(len(S)):
  S[i] = shift_char(S[i], n)
print(''.join(S))

Submission status: Accepted

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

ans = ''
for i in S:
    if ord(i) + N > 90:  # ord('A')が65, ord('Z')が90.ord()関数でchar型をint型に
        ans += chr(ord(i) + N - 26)
    else:
        ans += chr(ord(i) + N)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B

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

res = ""
for i in S:
    if ord(i)+N > 90:
        res += chr(ord(i)+N-26)
    else:
        res += chr(ord(i)+N)
        
print(res)

Submission status: Accepted

Solution code:
def b_rot_n(): 
    N = int(input())
    S = input()
    for znaczek in S: 
        if ord(znaczek)+N <= ord('Z'):
            print(chr(ord(znaczek)+N),end='')
        else: 
            print(chr(ord(znaczek)+N - 26), end='')
    print('')
b_rot_n()

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
ABC = ["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"]
ABC2 = ABC*3
answer = []
for i in s:
    k = ABC.index(i)
    answer.append(ABC2[k+n])

print("".join(answer))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
i= int(input())
s = input()
en = ['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 = [(en[(en.index(k)+i)%26]) for k in s]
print(''.join(s_list))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
N = int(input())
S = input()
result = ""

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

print(result)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

S_list=list(*S)

new_Sindex=(alphabet.index(S_list[0])+N)%26

new_S=""
for i in range(len(S_list)):
  new_Sindex=(alphabet.index(S_list[i])+N)%26
  new_S+=alphabet[new_Sindex]

print(new_S)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    s = list(map(ord, input()))

    for z in s:
        r = n+z
        if r > 90:
            r = r % 90 + 64
        print(chr(r), end='')
    print()

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
t = input()
S = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
shift = [S[(S.index(c)+n)%26] for c in t]
print(''.join(shift))

Submission status: Accepted

Solution code:
# ABC146B - ROT N
def main():
    N = int(input())
    S = input().rstrip()
    ans = "".join([chr(65 + (ord(ch) + N - 65) % 26) for ch in S])
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

def main(N, S):
    base = ord('A')
    res = ''.join(chr((ord(s) - base + N) % 26 + base) for s in S)
    print(res)


if __name__ == "__main__":
    N = int(input(''))
    S = input('')
    main(N, S)

Submission status: Accepted

Solution code:
N = int(input())

str = list(input())

out = []

for st in str:
    num = ord(st) + N
    if num >= 91:
        num = num - 26
    out.append(chr(num))

print("".join(out))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
l=string.ascii_uppercase
N=int(input())
S=input()
T=""
for i in range(len(S)):
  for j in range(26):
    if S[i]==l[j]:
      T+=l[(j+N)%26]
      break
print(T)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
min_abc = ord('A')
max_abc = ord('Z')
n = int(input())
s = input()
result=[]
for c in s:
    ascii_c = ord(c) + n
    if(ascii_c > max_abc):
        ascii_c = (min_abc-1) + (ascii_c-max_abc)
    result.append(chr(ascii_c))
print("".join(result))

Submission status: Accepted

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

for i in S:
    buf=ord(i)+N
    if buf>90:
        buf-=26
    print(chr(buf),end="")
print("")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
out_str=''
for i in s:
  m=ord(i)+n
  if m>90:
    m-=26
  out_str+=chr(m)

print(out_str)

Submission status: Accepted

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

for i in range(len(S)):
    tmp = ord(S[i])+N
    if(tmp>90):
        tmp -= 26
    print(chr(tmp),end='')

print('')

Submission status: Accepted

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

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

print(st);

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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):
    g = (rot_n(c, n) for c in s)
    return ''.join(g)


N = int(input())
s = input()
print(rot(s, N))

Submission status: Accepted

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

output = ''
for i in range(len(S)):
	tmp = ord(S[i])+N
	if tmp > 90:
		tmp = tmp - 90 + 64
	output += chr(tmp)

print(output)

Submission status: Accepted

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

T = [chr((ord(s)-65 + N)%26 + 65) for s in S]

print("".join(T))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
SHIFT_COUNT = int(input())
word = input()
result = ""

for s in word:
    if ord('a') <= ord(s) <= ord('z'):
        result = result + \
            chr(abs(((ord(s) + SHIFT_COUNT - ord('a')) % 26)) + ord('a'))
    else:
        result = result + \
            chr(abs(((ord(s) + SHIFT_COUNT - ord('A')) % 26)) + ord('A'))

print(result)

Submission status: Accepted

Solution code:
s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n = int(input())
input_s = input()
print(''.join([s[(s.index(c)+n) % 26] for c in input_s]))

Submission status: Accepted

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

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

Submission status: Accepted

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

l = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = []

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

print(''.join(ans))

Submission status: Accepted

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

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

print(Ans)

Submission status: Accepted

Solution code:
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
a = ''
for item in S:
  a_index = alphabet.index(item) + N
  if a_index > 25:
    a_index = a_index - 26
  a += alphabet[a_index]
print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = ""
for c in s:
    ans += alphabet[(n + alphabet.index(c)) % 26]

print(ans)

Submission status: Accepted

Solution code:
import sys
N = int(input())
S = input()
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
for s in S:
    sys.stdout.write(alp[ord(s) - 65 + N])

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ans = ""
 
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 
for c in s:
	ans += alphabet[(n + alphabet.index(c)) % 26]
    
print(ans)

Submission status: Accepted

Solution code:


N=int(input())

S=input()


def getShiftedStr(args,num):
    ConverseCode=''
    for i in args:
        t=ord(i)
        t+=num
        if t>90:
            t-=26
        new=chr(t)
        ConverseCode+=new
    print(ConverseCode)


getShiftedStr(S,N)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alph_list = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in s:
    pos =alph_list.find(i)
    print(alph_list[n+pos],end="")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alphabet_list = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
alphabet_dict = {alphabet_list[i]:i for i in range(26)}
ans = ""
for ss in s:
    ans += alphabet_list[(alphabet_dict[ss] + n) % 26]
print(ans)

Submission status: Accepted

Solution code:
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
result = ''
for i in range(len(S)):
	pos = 0
	pos = alpha.find(S[i])
	result += alpha[(pos+N)%26]
print(result)

Submission status: Accepted

Solution code:
import string

number = int(input())
strings = input()

alphabetlist = string.ascii_uppercase

res = ''

for i, j in enumerate(strings):
    res += alphabetlist[(alphabetlist.find(j)+number) % len(alphabetlist)]

print(res)

Submission status: Accepted

Solution code:
E=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

N=int(input())

S=list(input())

while(N>=26):
    N-=26


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

print("".join(S))

Submission status: Accepted

Solution code:
str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 

a = int(input())
s = list(input())

ans = ''
for char in s:
    
    c = str.index(char) + a 

    if c >= 26:
        c = c - 26
    ans = ans + str[c] #文字列は加算できる

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline
 
##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)
 
##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力
 
# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと
 
##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順
 
# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順
 
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    S = input()
    S = S[:-1]
    
    ans = ""
    for i in S:
        No = ord(i) + N
        if No > 90:
            No = No - 90 + 64
        tmp = chr(No)
        ans += tmp
    
    print(ans)
    
    
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
N=int(input())
S=input()
T='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
S2=''
for i in range(len(S)):
    n=T.find(S[i])
    if n+N<=25:
        S2=S2+T[n+N]
    else:
        S2=S2+T[n+N-26]
print(S2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input().strip())
S=input().strip()
import string
SS=string.ascii_uppercase+string.ascii_uppercase
ans=""
for s in S:
    ans+=SS[SS.index(s)+N]
print(ans)

Submission status: Accepted

Solution code:
abc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

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

for i, j in enumerate(s):
    num = abc.index(j)
    newnum = num+n
    s[i] = abc[newnum]

print(''.join(s))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
print(''.join([chr(65+(ord(t)+n)%65%26) for t in s]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# input() は 'python3' で正常に動く
N = int(input())
S = input()
 
str_list = list(S)
str_trsf = []
 
for item in str_list:
    str_trsf.extend(chr(N - (ord('Z') - ord(item) + 1) + ord('A')) if ord(item) + N > ord('Z') else chr(ord(item) + N))

print(''.join(str_trsf))

Submission status: Accepted

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

def alp_number(char):
    return ord(char) - ord('A')

def num_to_char(num):
    return chr(num + ord('A'))

ord_chars = [(alp_number(char) + n) % 26 for char in s]

answer = ''.join([num_to_char(num) for num in ord_chars])

print(answer)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
max_code=ord('Z')
converted = ''

for item in s:
    code = ord(item)
    code += n
    if code > max_code:
        code -= 26
    converted = converted + chr(code)

print(converted)

Submission status: Accepted

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

for i in range(len(s)):
  if (ord(s[i]) + n <= ord('Z')):
    result = result + chr(ord(s[i]) + n)
  else:
    result = result + chr(ord(s[i]) + n - 26)

print(result)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
sl = list(s)
alp = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
ans = []
for i in range(len(sl)):
    num = n + alp.index(sl[i])
    if num < 26:
        ans.append(alp[num])
    else:
        ans.append(alp[num - 26])
print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alpha_dict = {}
res = ""
for idx, letter in enumerate(alphabet):
    alpha_dict.setdefault(letter, idx)
for char in s:
    tmp = alpha_dict[char] + n
    if tmp >= 26:
        res += alphabet[tmp - 26]
    else:
        res += alphabet[tmp]
print(res)

Submission status: Accepted

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

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

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

print(r)

Submission status: Accepted

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


s = list(S)
s_new =[]
for i in range(len(S)):
    if ord(s[i])+N<91:
        s[i] = chr(ord(s[i])+N)
        s_new.append(s[i])
    else:
        s[i] = chr(ord(s[i])+N-26)
        s_new.append(s[i])
print(''.join(s_new))

Submission status: Accepted

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

out = []
for i in range(len(s)):
    if ord(s[i])+n <= 90:
        out.insert(i, chr(ord(s[i])+n))
    else:
        out.insert(i, chr(ord(s[i])-26+n))

for i in range(len(s)):
    print(out[i], end = '')

Submission status: Accepted

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

string = list(map(lambda x:ord(x)+n,string))


for e in string:
    if e <= 90:
        print(chr(e),end="")
    else:
        print(chr(e-26),end="")

Submission status: Accepted

Solution code:
N = input()
S = input()
li = list(S)
ans = []
alp = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

for i in range(len(li)):
  k = alp.index(li[i]) + int(N)
  if k < 26:
    ans.append(alp[k])
  else:
    ans.append(alp[k-26])
 
print(''.join(ans))

Submission status: Accepted

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

offset = ord('A')


def transform(c):
    code = ord(c)
    return chr((code - offset + n) % 26 + offset)


print(''.join(transform(c) for c in s))

Submission status: Accepted

Solution code:
ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
new_sent = ''

for c in S:
  id = ALPHA.index(c)
  id = (id+N) % 26
  newc = ALPHA[id]
  new_sent += newc
  
print(new_sent)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

N = input()
S = input()

shaffle = ''

for i in S:
  current = letters.index(i)
  current += int(N)
  if current >= len(letters):
    current -= 26
  shaffle += letters[current]

print(shaffle)

Submission status: Accepted

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

str = ''
for i in b:
    if ord(i) + a > ord('Z'):
        n = chr(((ord(i)+a)%ord('A'))-ord('Z')+2*ord('A')-1)
    else:
        n = chr(ord(i)+a)

    str = str + n

print(str)