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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
DICT = [chr(i) for i in range(65, 65+26)]
C = [0] * 26

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

ans = [None] * len(s)

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

print(''.join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
L=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
A = []
 
for c in S:
  i = L.index(c)
  A.append(L[(i + N)%26])
  
print(''.join(A))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
print(''.join(map(lambda c: alph[(alph.find(c) + n) % 26], s)))

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:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    s = S()
    ans = ''
    for c in s:
        new = (ord(c) + N - ord('A')) % 26 + ord('A')
        ans += chr(new)
    print(ans)
main()

Submission status: Accepted

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

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

print(U)

Submission status: Accepted

Solution code:
n=int(input())
print(''.join(list(map(lambda x:chr(65+(ord(x)-65+n)%26),list(input())))))

Submission status: Accepted

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

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

for i in range(len(S)):
  S[i] = alphabet_list[(ord(S[i]) - 64 + N) % 26 - 1]

print(''.join(S))

Submission status: Accepted

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

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

words = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

lis = list(words)

ans = ""
for w in list(s):
    idx = lis.index(w)
    n_idx = idx + n
    ans += lis[n_idx]
print(ans)

Submission status: Accepted

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

ans = []

for s in S:
    work = chr(65+(ord(s)-65+N)%26)
    ans.append(work)

print(''.join(ans))

Submission status: Accepted

Solution code:
alpha_dict = {chr(c):i+1 for i,c in enumerate(range(ord('A'),ord('Z')+1))}
#print(alpha_dict)
num2alpha = lambda c: chr(c+64)

N = int(input())
S = input()
for s in S:
    num = (alpha_dict[s] + N)
    if num > 26:
        num -= 26
    print(num2alpha(num),end="")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
N = int(input())
S = input()
ret = ""
for s in S:
  for i, alphabet in enumerate(ABC):
    if s == alphabet:
      break
  ret += ABC[(i + N) % 26]
  
print(ret)

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
a = [chr(ord("A") + i) for i in range(26)]
for i in range(len(s)):
    l = a.index(s[i])
    if l + n <= 25:
        s[i] = a[l + n]
    else:
        s[i] = a[l + n - 26]
print("".join(s))

Submission status: Accepted

Solution code:
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"]
N=int(input())
li=list(input())
for i in li:
  num=a.index(i)+N
  if num >= 26:
    num-=26
  print(a[num],end="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
dic={
     "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

}

gyaku={
    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"
}
N=int(input())
li=list(input())

for i in range(len(li)):
  a=dic[li[i]]+N
  if a>26:
    a-=26
  li[i]=gyaku[a]
for i in range(len(li)):
  print(li[i],end="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
N = int(input())
S = list(input())
alp = list(string.ascii_uppercase)
lst = []

for i in S:
    tmp = alp.index(i)+N
    if tmp > 25:
        lst.append(tmp - 26)
    else:
        lst.append(tmp)

a = [ alp[i] for i in lst]
print(''.join(a))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ordA  = ord('A')
ans = []
for c in S:
    ans.append(chr((ord(c)+N-ordA) % 26 + ordA))
print(''.join(ans))

Submission status: Accepted

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

def func(mozi):
  ord_mozi=ord(mozi)
  new_ord_mozi=(ord_mozi-65+N)%26+65
  new_chr_mozi=chr(new_ord_mozi)
  return new_chr_mozi

new_alp=map(func,alp)
print("".join(new_alp))

Submission status: Accepted

Solution code:
N=int(input())
S=input()
Alp={"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}
new_Alp=[]

for i in range(len(S)):
  num=Alp[S[i]]
  num+=N
  num%=26
  
  for key,atai in Alp.items():
    if atai==num:
      new_Alp.append(key)

new_alp="".join(new_Alp)
print(new_alp)

Submission status: Accepted

Solution code:
alpa = [chr(ord('a') + i) for i in range(26)]

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

ans = ''

for i in s:
    ans += alpa[(alpa.index(str.lower(i))+n) % 26]
    
print(str.upper(ans))

Submission status: Accepted

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

ans = ""
for i in range(len(s)):
  num = ord(s[i])
  num = num + (KEY % 26)
  if ord("Z") < num:
    num = ord("A") + num - ord("Z") - 1
  ans += chr(num)
print(ans)

Submission status: Accepted

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

alphabet="ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in S:

    s=ord(i)
    s=(s-65+N)%26+65
    i=chr(s)
    letters+=i
print(letters)

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
ss = ''

for i in range(len(s)):

    ss += str(alp[alp.index(s[i])+n])

print(ss)

Submission status: Accepted

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

a_z_list = [""] * 26
for i in range(65,65+26):
    a_z_list[i - 65] = chr(i)

a_z_list *= 2

ans = []

for i in s:
    ans.append(a_z_list[ord(str(i)) -65 + N ])

print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
S_list=list(S)
ans=""
str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for i in range(len(S_list)):
    for j in range(len(str)):
        if S_list[i]==str[j]:
            ans+=str[(j+N)%26]
            break

print(ans)

Submission status: Accepted

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

alpabet = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
ans = ""
for i in s:
  ans+=alpabet[(alpabet.index(i)+n)%26]
  
print(ans)

Submission status: Accepted

Solution code:
def q2(in_num, in_str):
    o_str = ""
    letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    for i in range(len(in_str)):
        o_str += (letters[(letters.index(in_str[i])+int(in_num))%26])
    return o_str

print(q2(input(),input()))

Submission status: Accepted

Solution code:
ans=""
alphabet=list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N=int(input())
s=input()
toInt={}
for i in range (len(alphabet)):
    toInt[alphabet[i]]=i
for i in range (len(s)):
    c=(toInt[s[i]]+N)%26
    ans+=(alphabet[c])
print(ans)

Submission status: Accepted

Solution code:
import string
List = [chr(i) for i in range(65,65+26)]
N = int(input())
s = list(input())
ans = ''
for i in range(len(s)):
  Next_index = List.index(s[i])+N
  if Next_index>25:
    Next_index = abs(26-Next_index)
  ans += List[Next_index]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ordA = ord('A')
ans = []
for c in S:
    ans.append(chr((ord(c)+N-ordA) % 26 + ordA))
print(''.join(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
shift = int(input())
string = input()
out = ""

letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for s in string:
    out += letters[(letters.index(s) + shift) % 26]

print(out)

Submission status: Accepted

Solution code:
from sys import stdin

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

ans = ''

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

Submission status: Accepted

Solution code:
N=int(input())
S=input()
a=[]
b=[]
for i in range(26):
  a.append(chr(i+65))

for j in range(len(S)):
  for k in range(26):
    if S[j]==a[k]:
      b.append(a[(k+N)%26])
      break;
o=''.join(b)
print(o)

Submission status: Accepted

Solution code:
import string

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

lis = list(string.ascii_uppercase)
answer = []

for s in S:
    index = lis.index(s)
    slide_index = index + N
    if slide_index > 25:
        slide_index -= 26
    new_s = lis[slide_index]
    answer.append(new_s)

answer = ''.join(answer)

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alphabet = 'ZABCDEFGHIJKLMNOPQRSTUVWXY'
alphabet_num = {st: num for num, st in enumerate(alphabet)}
alphabet_list = [st for st in alphabet]

for s in S:
  num = (alphabet_num[s] + N) % 26
  print(alphabet_list[num], end='')

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alphabet = 'ZABCDEFGHIJKLMNOPQRSTUVWXY'
alphabet_num = {st: num for num, st in enumerate(alphabet)}
alphabet_list = [st for st in alphabet]

output = ''
for s in S:
  num = (alphabet_num[s] + N) % 26
  output += alphabet_list[num]
print(output)

Submission status: Accepted

Solution code:
upper = [chr(i) for i in range(65, 65+26)]

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

ans = []
for s in S:
    idx = upper.index(s)
    ans.append(upper[(idx+N)%26])
print(''.join(ans))

Submission status: Accepted

Solution code:
ref = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
res = ''
for c in S:
  res+=ref[ref.find(c) + N]
 
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
char=['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())
ans=''
for i in range(len(s)):
    ans+=char[(char.index(s[i])+n)%26]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
li = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
sli = list(S)
for i in range(len(sli)):
  for j in range(26):
    if li[j] == sli[i]:
      sli[i] = li[j+N]
      break
print("".join(sli))

Submission status: Accepted

Solution code:
ref = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
res = ''
for c in S:
  res += ref[ref.find(c) + N]

print(res)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
s = [i for i in S]

for i in range(len(S)):
  index = alp.index(S[i])
  ans_index = (index + N + 1) % 26
  s[i] = alp[ans_index - 1]

ans = ""
for i in s:
  ans += i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def main():
    num = int(input())
    string = input()
    string_list = ['' for i in range(len(string))]
    for i in range(len(string)):
        string_list[i] = (ord(string[i]) - 65 + num) % 26
        string_list[i] = chr(string_list[i] + 65)

    result = ''.join(string_list)
    print(result)





if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
kai = []
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 n in range(len(S)):
    for num,c in enumerate(alpha):
        if S[n] == c:
            if num + N > 25:
                num = num + N - 26
                kai.append(alpha[num])
                break
            kai.append(alpha[num + N])
            break

print("".join(kai))

Submission status: Accepted

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

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

for i in range(len(s)):
  a = alp.index(s[i])
  b = a+n
  if b > 25:
    b = b - 26
  out += alp[b]

print(out)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ltrs = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for ltr in S:
    idx = (ltrs.index(ltr) + N) % 26
    ans += ltrs[idx]
print(ans)

Submission status: Accepted

Solution code:
if __name__=='__main__':
    n=int(input())
    s=input()
    result=""
    for i in range(len(s)):
        result=result+chr(abs(ord(s[i])+n-ord('A'))%26+ord('A'))
    print(result)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
result = ""
for s in S:
    if ord(s) + N <= 90:
        result += chr(ord(s) + N)
    else:
        result += chr(ord(s) + N - 26)
print(result)

Submission status: Accepted

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

alphabet = [chr(ord("A") + i) for i in range(26)]


for i in n:
    a = (alphabet.index(i) + s) % 26
    r.append(alphabet[a])

print("".join(r))

Submission status: Accepted

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

for s in S :
    m = ord(s)+n
    if m > ord("Z") :
        m -= 26
    r+=chr(m)

print(r)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
# input = sys.stdin.readline
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    n=ii()
    S=list(input())
    for s in S: print(chr(ord(s)+n-26) if ord(s)+n>90 else chr(ord(s)+n), end='')
    print()

if __name__ == "__main__":
    main()

Submission status: Accepted

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

ans = ""
asc_a = ord("A")

for si in S:
  asc = ord(si)
  asc = asc_a + (asc - asc_a + N)%26
  ans += chr(asc)
  
print(ans)

Submission status: Accepted

Solution code:
# print(ord("A"))
inc = int(input())
string = input()

for n in string:
    print(chr((ord(n) + inc - 65) % 26 + 65), end="")

print()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
S_ = ''
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for bet in S:
    S_ += alphabet[(alphabet.index(bet)+N)%26]
print(S_)

Submission status: Accepted

Solution code:
# coding: utf-8
import string

alphabet = string.ascii_uppercase + string.ascii_uppercase

n_steps = int(input())
row_text = input()
processed_tuple = (alphabet[alphabet.index(x)+n_steps] for x in row_text)
print(*processed_tuple, sep = '')

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']
N = int(input())
S = input()
r = ''

n = len(S)
for j in range(0, n):
    k = alp.index(S[j])
    x = (k + N) % 26
    r = r + alp[x]

print(r)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
    for k in range(26):
        if S[i] == AtoZ[k]:
            Ans += AtoZ[(k+N)%26]
    
print(Ans)

Submission status: Accepted

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

Submission status: Accepted

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

C = [chr((ord(s) - ord('A') + N) % 26 + ord('A')) for s in S]

print("".join(C))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
char = stdin.readline().rstrip()


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']
s = ""

for c in char:
    arr_num = int(al.index(c.lower()))

    if  arr_num + n > 25:
        s += al[arr_num + n - 26]
    else:
        s += al[arr_num + n]

print(s.upper())

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
al = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
for i in range(len(s)):
  ind = al.index(s[i]) + n
  if ind > 25:
    ind = ind - 26
  s[i] = al[ind]
print("".join(s))

Submission status: Accepted

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

alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
di = {}
for i in range(len(alp)):
    di[alp[i]] = i
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
# N = N % len(S)

ans = []
for s in S:
    ans.append(alp[di[s]+N])

print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
a = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in s:
    print(a[(a.index(i) + n) % 26], end = '')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n=int(input())
    ans=[]
    for s in input():
        k=(ord(s)-ord('A')+n)%26+ord('A')
        ans.append(chr(k))

    print(''.join(ans))
resolve()

Submission status: Accepted

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

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
assert len(alphabet) == 26

d = {char:alphabet.index(char) for char in alphabet}

new_string = ""
for char in string:
    new_string += alphabet[(d[char] + num) % 26]
print(new_string)

Submission status: Accepted

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

for i in range(len(s)):
    tmp = ord(s[i]) + n
    if tmp > ord('Z'):
        tmp -= ord('Z') - ord('A') + 1
    s[i] = chr(tmp)

ans = ''
for i in range(len(s)):
    ans += s[i]

print(ans)

Submission status: Accepted

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

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

print()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
str_input = input()
str_arr = list(str_input)

for i in range(len(str_arr)):
    if ord(str_arr[i]) + num <= ord("Z"):
        str_arr[i] = chr(ord(str_arr[i]) + num)
    else:
        str_arr[i] = chr(ord(str_arr[i]) - ord("Z") + ord("A") + num - 1)
print("".join(str_arr))

Submission status: Accepted

Solution code:
t = lambda c: ord(c) - ord('A') + 1
h = lambda c: chr(c+64)
n = int(input())
a = input()
l = list(a)
f = []
for i in l:
    p = int(t(i))
    j = p+n
    while j >26:
        j-=26
    b = h(j)
    f.append(b)
print("".join(f))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for c in s:
  print(a[(a.index(c) + n) % 26], end='')

Submission status: Accepted

Solution code:
n=int(input())
s=input()
if n==0:
    print(s)
else:
    m=len(s)
    ch=''
    for i in range(m):
        a=ord(s[i])+n
        if a>90:
            b=65+a-91
            b=chr(b)
            ch+=b
        else:
            ch+=chr(a)
    print(ch)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(S)):
    num = alf.index(S[i])
    ans.append(alf[num + N])


print(''.join(ans))

Submission status: Accepted

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

ret = []
for x in S:
    c = ord(x) + N
    if c <= 90:
        ret.append(chr(c))
    else:
        ret.append(chr(c - 26))

print("".join(ret))

Submission status: Accepted

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

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

word = []

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

Submission status: Accepted

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

a = ord("A")
ans = ""

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

print(ans)

Submission status: Accepted

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

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

res = ''

for a in s:
    index = alpha.index(a) + n
    # print(alpha[index + n])
    if index >= ma:
        index = index % ma
    
    res  += alpha[index]

print(res)

Submission status: Accepted

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

string = {c:i for i,c in enumerate(ascii_uppercase)}
res = ""
for c in S:
    res += ascii_uppercase[(string[c]+N)%26]
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

# process
slist = list(s)

for i in range(len(slist)):
    t = ord(slist[i]) + n

    if t > ord("Z"):
        t -= 26
    slist[i] = chr(t)

# output
print("".join(slist))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
s = [ord(c) + n for c in s]
s = [chr(c) if ord('A') <= c <= ord('Z') else chr(c - ord('Z') + ord('A') - 1) for c in s]
print(''.join(s))

Submission status: Accepted

Solution code:
N = int(input())
S = input()#英大文字からなる文字列
ans = ''
for s in S:
    ss = ord(s)
    while (ss+N>ord('Z')):
        ss -= 26
    ans += chr(ss+N)
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
l = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')

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

print(''.join([l[(l.index(x) + n) % 26] for x in s]))

Submission status: Accepted

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

Submission status: Accepted

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

ABC = [chr(ord('A') + i) for i in range(26)]
for i in range(len(S)):
  if ABC.index(S[i])+1 + N <= 26:
    S[i] = ABC[ABC.index(S[i]) + N]
  else:
    S[i] = ABC[ABC.index(S[i]) + N - 26]
# print(S)
S = ''.join(S)
print(S)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
fin = ''
for i in range(len(s)):
  t = ord(s[i])-ord('A')+n 
  if (t > 25):
    fin += chr(ord('A')+t-26)
  else:
    fin +=chr(ord('A')+t)
print(fin)

Submission status: Accepted

Solution code:
z="ABCDEFGHIJKLMNOPQRSTUVWXYZ"*2
n=int(input())%26
s=input()
out=[]
for a in s:
    out.append(z[z.find(a)+n])
print("".join(out))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
s_list = list(s)
alphabet = [chr(ord('a') + i) for i in range(26)]

for i in range(len(s)):
  if(ord(s[i]) + n >= 91):
    s_list[i] = chr(ord(s[i]) + n -26)
  
  else:
    s_list[i] = chr(ord(s[i]) + n)
  
s = "".join(s_list)
print(s)

Submission status: Accepted

Solution code:
alpha2int = lambda x: ord(x) - ord("A") + 1
def int2alpha(x):
    if  x % 26 != 0:
        x = x % 26 
    else:
        x = 26
    return chr(x + 64)

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

out_s = ""
for i in range(len(S)):
    out_s += int2alpha(alpha2int(S[i]) + N)
    
print(out_s)

Submission status: Accepted

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

n = int(input())
strings = input()

newStr = ''
for i in range(len(strings)):
    nextAlpha = ord(strings[i]) + n
    if nextAlpha <= 90:
        newStr += chr(nextAlpha)
    else:
        nextAlpha -= 91
        newStr += chr(65 + nextAlpha)
        
print(newStr)

Submission status: Accepted

Solution code:
from collections import Counter

mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft



def main():
    n = int(input())
    s = input()
    for i in s:
        a = ord(i) - ord('A')
        a = (a + n) % 26
        print(chr(a + ord('A')), end='')
    print()

main()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
new_s = ''
alpha2num = lambda x: ord(x)-65
num2alpha = lambda x: chr(x+65)
for i in s:
    tmp = alpha2num(i) + n
    tmp %= 26
    new_s += num2alpha(tmp)
print(new_s)

Submission status: Accepted

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

Submission status: Accepted

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

def change(c):
    x = ord(c) - ord("A") + n
    x %= 26
    return chr(ord("A") + x)

ans = ""
for i in s:
    ans += change(i)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def mainFunc():
    alphabets = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
    N = int(input())
    S = list(input())
    ans = ''

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

mainFunc()

Submission status: Accepted

Solution code:
import string

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

letters = string.ascii_uppercase + string.ascii_uppercase
letters = letters[N:N+26]
mapping = {s: letters[idx] for idx, s in enumerate(string.ascii_uppercase)}

ans = "".join(map(lambda s: mapping[s], S))
print(ans, flush=True)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
A = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
SS = list(S)
for i in range (len(S)):
  if A.index(S[i]) + N >= 26:
    SS[i] = A[int(A.index(S[i])+N-26)]  
  else:
    SS[i] = A[int(A.index(S[i])+N)]
SS = "".join(SS)
print(SS)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

s = str(input())

cc = ""

m = len(s)

for i in range(m):
    if ord(s[i]) + n <= 65 + 25:
        cc += (chr(ord(s[i]) + n))
    else:
        cc += (chr(ord(s[i]) + n - (65 + 25) + 64))

print(cc)