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:
def a2a(alpha,n):
    if ord(alpha)+n-ord("A")<26:
        return chr(ord(alpha)+n)
    else:
        return chr(ord(alpha)+n-26)
N=int(input())
S=input()
ans=""
for t in S:
    ans=ans+a2a(t,N)
print(ans)

Submission status: Accepted

Solution code:
import string

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

for a in S:
    index = string.ascii_uppercase.index(a)
    index = (index + N) % 26
    print(string.ascii_uppercase[index], sep='', end='')

Submission status: Accepted

Solution code:
letters = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
L = len(letters)

n = int(input())
word = input()
result = ''

for letter in word:
  idx = letters.index(letter)
  f_idx = (idx + n) % L
  result += letters[f_idx]

print(result)

Submission status: Accepted

Solution code:
letters = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
L = len(letters)

n = int(input())
n %= L
word = input()
result = ''

for letter in word:
  idx = letters.index(letter)
  moves = n
  diff = L - idx
  f_index = idx
    
  if moves + idx >= L:
    f_index = moves - diff
  else:
    f_index = idx + moves
    
  result += letters[f_index]
  
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''input
2
ABCXYZ
'''
# A coding delight https://ideone.com/m98Hht
from sys import stdin
input = stdin.readline


# main starts
n = int(input().strip())
string = list(input().strip())
for i in range(len(string)):
	if ord(string[i]) + n > 90:
		string[i] = chr(64 + n - (90 - ord(string[i])))
	else:
		string[i] = chr(ord(string[i]) + n)

print(''.join(string))

Submission status: Accepted

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

#ABC=[chr(i) for i in range(ord('A'), ord('Z')+1)]

S2=[chr(ord(s)+N) if ord(s)+N<=ord('Z') else chr(ord(s)+N-26) for s in S]
answer = ''.join(S2)
print(answer)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
Slong=len(S)
T=""

import string

eng=string.ascii_uppercase*2

for i in range(Slong):
    m= eng.find(S[i])
    m= m + N
    T=T+eng[m]

print(T)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

N = int(input())
S = input()
list_S = list(S)
list_ans = []

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

number_alphabet = {1:'A', 2:'B', 3:'C', 4:'D', 5:'E', 6:'F', 7:'G', 8:'H', 9:'I', 10:'J', 11:'K', 12:'L', 13:'M',
                   14:'N', 15:'O', 16:'P', 17:'Q', 18:'R', 19:'S', 20:'T', 21:'U', 22:'V', 23:'W', 24:'X', 25:'Y', 26:'Z'}

for i in range(len(list_S)):
    A = alphabet_number[list_S[i]]
    
    if A + N <= 26:
        B = A + N
    else:
        B = (A+N) - 26
        
    C = number_alphabet[B]
    list_ans.append(C)

print(''.join(list_ans))

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    S = input()
    answer = encrypt_ceasor(S, N)
    print(answer)

      
def encrypt_ceasor(text, n):
    result = ""
    for i in range(len(text)):
        char = text[i]
        if char.isupper():
            result += chr((ord(char) + n - 65) % 26 + 65)
        else:
            result += chr((ord(char) + n - 97) % 26 + 97)
    return result


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
A=[chr(i) for i in range(65, 65+26)]
N=int(input())
S=str(input())
T=[]
U=str()

for i in range(len(S)):
  k=(A.index(S[i])+N)%26
  T.append(A[k])
  U=U+str(T[i])
  
print(U)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import string
alphabet = string.ascii_uppercase
 
N = int(input())
chara = input()
 
for ch in chara:
  index = alphabet.index(ch)
  pr = alphabet[(index + N) % 26]
  print(pr,end = '')

Submission status: Accepted

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

import sys
sys.setrecursionlimit(300000)


def solve(N: int, S: str):
    ret = ''
    for c in S:
        ret +=  chr(ord('A') + (ord(c) - ord('A') + N) % 26)
    print(ret)
    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:
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
S = [int(x) - ord('A') for x in readline().rstrip()]
S = [(x + N)%26 for x in S]

ans = ''.join(chr(x+ord('A')) for x in S)
print(ans)

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 8, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

# word = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
N = int(readline())
S = [int(x)-ord('A') for x in read().rstrip()]
S=[(x+N)%26 for x in S]

ans = ''.join(chr(x+ord('A')) for x in S)

print(ans)

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 8, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

word = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
N = int(readline())
S = readline().decode('utf8').rstrip()

ans = [None] * len(S)
for i in range(len(S)):
    ans[i] = word[(word.index(S[i]) + N) % len(word)]

ans=''.join(ans)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
str = ""
for i in range(len(s)):
  str += al[(al.find(s[i])+n)%26]
print(str)

Submission status: Accepted

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

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

#Generate empty output
output = ''

for i in range(len(S)):
    #Get the index of an alphabet in the list
    ind1 = alphabet.index(string[i])
    #Divide N by 26 and get the remainder
    ind2 = (int(ind1) + N) % 26
    #Update the letter and keep adding it to the list
    output += alphabet[ind2]

print(output)

Submission status: Accepted

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

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

for i in S:
    Index = upper.index(i) + N
    if Index >= 26:
        Index -= 26
        new_upper.append(upper[Index])
    else:
        new_upper.append(upper[Index])
        
print(''.join(new_upper))

Submission status: Accepted

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

def tran(char, num):
	after = ord(char) - 65 + num
	return(chr(after % 26 + 65))
  
after = list(map(lambda x: tran(x, num), S))
print("".join(after))

Submission status: Accepted

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

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c <= 25:
      S[i] = al[c]
  else:
      S[i] = al[c-26]
      
print("".join(S))

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 146 - B
# -*- encoding: UTF-8 -*-

n = int(input())
s = input()
result = ""

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

print(result)

Submission status: Accepted

Solution code:
n = int(input())
s = 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']

l = []
ans = []
for i in range(len(s)):
    l.append(s[i])
    index_s = abc.index(s[i])
    index_n = (n + index_s) % 26
    ans.append(abc[index_n])
    
print(''.join(ans))

Submission status: Accepted

Solution code:
ALPHABET = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

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

    ans = ""
    for s in S:
        index = ALPHABET.index(s) + N
        ans += ALPHABET[index % len(ALPHABET)]

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

for x in range(0, len(S)):
    S[x] = ord(S[x]) + N
    if S[x] > 90:
        S[x] = S[x] - 26
    S[x] = chr(S[x])

print(''.join(S))

Submission status: Accepted

Solution code:
import string

letters = [chr(i) for i in range(ord('A'), ord('Z')+1)]
mod = ord('Z')+1-ord('A')

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

ans = ""
for ids in s:
    idx = (ord(ids) - ord('A') + n) % mod
    ans += letters[idx]

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = ''.join(list(map(lambda x :chr((ord(x) + N - 65) % 26 + 65), list(S))))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
x = []
import string
a = list(string.ascii_uppercase)*2
#print(a)
for i in s:
    b = a.index(i)
    x.append(a[b + n])
    
print(''.join(x))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
x = []
import string
a = list(string.ascii_uppercase)*2
#print(a)
for i in s:
    #j = 0
    b = a.index(i)
    j = b + n
    x.append(a[j])
    
print(''.join(x))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
x = []
import string
a = list(string.ascii_uppercase)*2
#print(a)
for i in s:
    j = 0
    b = a.index(i)
    j = b + n
    x.append(a[j])
    
print(''.join(x))

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    s = S()
    r = []
    d = {}
    for i in range(26):
        d[string.ascii_uppercase[i]] = string.ascii_uppercase[(i+n)%26]
    for c in s:
        r.append(d[c])

    return JA(r, "")


print(main())

Submission status: Accepted

Solution code:
def main():
    alpha = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
    n = int(input())
    s = input()
    output = ''
    for c in s:
        index = alpha.index(c) + n
        index = index % 26
        output += alpha[index]
    print(output)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(input())
S = input()
l = [] 
for i in S:
    b = a.index(i) + N
    if b <= 25:
        w = a[b]
    else:
        w = a[b-26]
    l.append(w)
print("".join(l))

Submission status: Accepted

Solution code:
a = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
N = int(input())
S = input()
 
for i in S:
    b = a.index(i) + N
    if b <= 25:
        print(a[b], end="")
    else:
        print(a[b-26], end="")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = input()
sl = list(s)
alph = ['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(sl)):
  id_a = alph.index(sl[i])
  id_b = (int(id_a) + n) % 26
  out += alph[id_b]
print(out)

Submission status: Accepted

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

A = ""
num = 0
for s in S:
    num = (ord(s) + N) if ord(s) + N < 91 else (ord(s) + N - 26)
    A += chr(num)

print(A)

Submission status: Accepted

Solution code:
input = [input() for i in range(2)]

n = int(input[0])
s = list(input[1])
answer = []
alf = [chr(ord('A') + i) for i in range(26)]


for letter in s:
  for index, al in enumerate(alf, 1):
    if(al == letter):
      if(index + n < len(alf)):
          answer.append(alf[index + n -1])
      else:
        extra = (index + n) % len(alf)
        answer.append(alf[extra -1])
		
print(''.join(answer))

Submission status: Accepted

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

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

print(''.join(chr(s + 65) for s in S))

Submission status: Accepted

Solution code:
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
numN = int(input())
stS = input()
result = ""
for i, c in enumerate(stS):
  result += alphabet[(alphabet.index(c) + numN) % len(alphabet)]
  
print(result)

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
for x in s:
  k = ord(x)+n
  if k >= 91:
    k -= 26 
  print(chr(k), end ="")

Submission status: Accepted

Solution code:
import sys
import math
import heapq
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
DVSR = 1000000007
def POW(x, y): return pow(x, y, DVSR)
def INV(x, m=DVSR): return pow(x, m - 2, m)
def DIV(x, y, m=DVSR): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())
def FLIST(n):
    res = [1]
    for i in range(1, n+1): res.append(res[i-1]*i%DVSR)
    return res
def gcd(x, y):
    if x < y: x, y = y, x
    div = x % y
    while div != 0:
        x, y = y, div
        div = x % y
    return y

N=II()
S=input()
ABCABC = [chr(65+(i%26)) for i in range(52)]

for c in S:
    print(ABCABC[ord(c)-65+N], end='')

print('')

Submission status: Accepted

Solution code:
n = int(input())
s = input()
new_s = []
for c in s:
 a = chr((ord(c)-ord("A")+n)%26+ord("A"))
 new_s.append(a)

print("".join(new_s))

Submission status: Accepted

Solution code:
def alpha2alpha(alpha,n):
    if ord(alpha)+n-ord("A")<26:
        return chr(ord(alpha)+n)
    else:
        return chr(ord(alpha)+n-26)
N=int(input())
S=input()
T=""
for t in S:
    T=T+alpha2alpha(t,N)
print(T)

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
A = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
for i in range(len(S)):
  for j in range(26):
    if S[i]==A[j]:
      S[i]=A[(j+N)%26]
      break
print(''.join(S))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans = ""
for char in list(S):
	asc = ord(char)
	num = asc - 65
	num = (num + N) % 26
	asc = num + 65
	ans += chr(asc)
print(ans)

Submission status: Accepted

Solution code:
def rot_n(s, n):
  ts = ''
  alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  for i in range(len(s)):
    idx = alpha.index(s[i])
    idx += n
    if idx > 25:
      idx -= 26
    ts += alpha[idx]
  print(ts)

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

rot_n(s, n)

Submission status: Accepted

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

z = ord('Z')

ans = ''
for s in S:
    a = ord(s)
    b = a + N
    if b > z:
        b -= 26
    ans += chr(b)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

for i in s:
    if ord(i)+n > 90:
        list.append(chr(ord(i)+n-26))
    else:
        list.append(chr(ord(i)+n))
        
ans = "".join(list)
print(ans)

Submission status: Accepted

Solution code:
n1 = int(input())
s2 = input()
s4 = ""

for i3 in range(len(s2)):
    s4 += (chr(((ord(s2[i3]) + n1 - 65) % 26 ) + 65))

print(s4)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

for i in S : 
    if ord(i)+N > 90 : 
        list.append(chr(ord(i)+N-26))
    else : 
        list.append(chr(ord(i)+N))

string = ''.join(list)

print(string)

Submission status: Accepted

Solution code:
# ROT N

# libraries
from string import ascii_uppercase as ALP

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

# solve
ALPALP = ALP + ALP

def f(s, N = N):
    return ALPALP[ALPALP.index(s) + N]

res = ''.join([f(s) for s in S])

# output
print(res)

Submission status: Accepted

Solution code:
#AtCoder
from string import ascii_uppercase as alphabet

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

res = ''
a = []

for c in alphabet:
    a.append(c)

for s in S:
    res += a[(a.index(s) + N) % len(alphabet)]

print(res)

Submission status: Accepted

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

for s in S:
    tmp = int(a.index(s))
    tmp = tmp + N
    print(a[tmp % 26], end="")

Submission status: Accepted

Solution code:
import re
n = int(input())
s = input()
alpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for i in s:
    i = alpha.find(i)
    i += n
    if i >= 26:
        i -= 26
    ans += alpha[i]

print(ans)

Submission status: Accepted

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

alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

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

Submission status: Accepted

Solution code:
from string import ascii_uppercase as alph


def main():
    N = int(input())
    S = input()
    result = ''
    alphabets = []
    for a in alph:
        alphabets.append(a)
    for s in S:
        result += alphabets[(alphabets.index(s) + N) % len(alphabets)]
    print(result)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
ans = ""
for s in S:
    ans += chr(((ord(s) - ord("A") + N) % 26) + ord("A"))
print(ans)

Submission status: Accepted

Solution code:
alph = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

key = int(input())
text = input()
cyph = ""

for c in text:
  cyph += alph[(alph.index(c) + key) % 26]

print(cyph)

Submission status: Accepted

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

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans = ""
for i in range(len(s)):
    ans+= alphabet[(alphabet.find(s[i])+n)%26]

print(ans)

Submission status: Accepted

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

n = int(input())
s = input()
print(rot_encode(n)(s))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
import string
ABC = list(string.ascii_uppercase)
for i in range(len(s)):
    s[i] = ABC[(ABC.index(s[i]) + n) % 26]
for i in range(len(s)):
    print(s[i], end = '')
print('\n')

Submission status: Accepted

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

alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

newS = S.translate(str.maketrans(alphabet, alphabet[N:]+alphabet[:N]))
print(newS)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
list_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']
ans = ''
for i in s:
    if list_abc.index(i) + n < 25:
        ans += list_abc[list_abc.index(i) + n]
    else:
        ans += list_abc[list_abc.index(i) + n- 26]
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"]

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

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

ans = 0
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
n = inp()
S = input()
ans_string = ''

for i in range(len(S)):
    ans_string += alphabet[(alphabet.index(S[i])+n)%26]
print(ans_string)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
letters = [chr(i) for i in range(65, 65+26)]
ans = ''
for i in S:
  ans+=letters[(letters.index(i)+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 <= 90:
                ans += chr(ord(S[i]) + N)
        else:
                ans += chr(ord(S[i]) + N - 90 + 64)
print(ans)

Submission status: Accepted

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

alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
len_alpha = len(alpha)
len_s = len(s)
ss = []

for i in range(len_s):
    index_ss = (alpha.index(s[i])+n)%len_alpha
    ss += alpha[index_ss]
ans = "".join(ss)
print(ans)

Submission status: Accepted

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

R = []

for i in range(len(S)):
    if (ord(S[i]) + N) <= 90:
        R.append(chr((ord(S[i]) + N)))
    else:
        R.append(chr((ord(S[i]) + N - 26)))

print("".join(R))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
al=[chr(i) for i in range(65, 65+26)]
n=int(input())
s=list(input())
for i in range(len(s)):
    ind=al.index(s[i])
    ind=(n+ind)%26
    s[i]=al[ind]
print(''.join(s))

Submission status: Accepted

Solution code:
num = int(input())
s = input()
res = ''

allAlphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

for i in range(len(s)):
  res += allAlphabet[(allAlphabet.find(s[i]) + num) % 26]
  
print(res)

Submission status: Accepted

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

ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

string = ""
for char in S:
    string += ABC[(ABC.index(char) + N) % 26]
print(string)

Submission status: Accepted

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

def AtoZ(L):
  return chr(((ord(L)+N)-65) % 26 + 65)
T =""
for i in range(len(S)):
  T += AtoZ(S[i])
print (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:
N = int(input())
S = 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']
print("".join([alpha[(alpha.index(S[i])+N)%26] for i in range(len(S))]))

Submission status: Accepted

Solution code:
n = int(input())
ch_a, ch_z = (65, 90)

s = [ord(_)+n for _ in input()]
ss = [chr(m) if m <= ch_z else chr(m - ch_z + ch_a - 1) for m in s]
print(''.join(ss))

Submission status: Accepted

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

result =  ''
for i in range(len(str)):
    ordStr = ord(str[i]) + N
    if ordStr > ord("Z"):
        ordStr = ordStr - 26
    result += chr(ordStr)
    
print(result)

Submission status: Accepted

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

z_ascii = ord('Z')
a_ascii  = ord('A')-1
for s in range(len(S)):
    s_ascii = ord(S[s])
    s_ascii = s_ascii + N
    if s_ascii > z_ascii:
        s_ascii = s_ascii - z_ascii 
        s_ascii = a_ascii + s_ascii
    S[s] = chr(s_ascii)

print(*S,sep="")

Submission status: Accepted

Solution code:
def ints():
  return [int(x) for x in input().split()]
def readi():
  return int(input())

n = readi()
s = input()
for i in range(len(s)):
  w = ord(s[i])+n
  if w>ord('Z'):
    w = w-ord('Z')+ord('A')-1
  print(chr(w), end='')
print()

Submission status: Accepted

Solution code:
N = int(input())
S = list(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']
idx = []
for s in S:
    idx.append(alphabet.index(s) + N)

for i in range(len(idx)):
    tmp = idx[i]
    while tmp >= 26:
        tmp -= 26
    idx[i] = tmp

for i in idx:
    print(alphabet[i], end='')

Submission status: Accepted

Solution code:
n = int(input())
s = input()
t = list()
a = ["A", "B", "C", "D", "E", "F", "G",
     "H", "I", "J", "K", "L", "M", "N",
     "O", "P", "Q", "R", "S", "T", "U",
     "V", "W", "X", "Y", "Z"]
b = 0
for i in range(len(s)):
    for j in range(26):
        if s[i] == a[j]:
            b = (j + n)
            if b >= 26:
                print(a[b - 26], end = "")
            else:
                print(a[b], end = "")
            break
print()

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
lst_26 = [(chr(ord("a") + i)).upper() for i in range(26)]

for i in range(len(s)):
    if lst_26.index(s[i])+n >= 26:
        s[i] = lst_26[lst_26.index(s[i])+n-26]
    else:
        s[i] = lst_26[lst_26.index(s[i])+n]
print("".join(s))

Submission status: Accepted

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

Submission status: Accepted

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


for i in range(len(S)):
    ss=S[i].lower()
    tmp=ord(ss) - ord("a")+N
    num=tmp%26 + ord("a")
    ss=chr(num)
    S[i]=ss.upper()

S="".join(S)
print(S)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ciphertext = ''
for i in list(s):
    if 'A' <= i <= 'Z':
            ciphertext += chr((ord(i) - ord('A') + int(n)) % 26 + ord('A'))
print(ciphertext)

Submission status: Accepted

Solution code:

n = int(input())
s = input()
ans=[]
a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
a_list=[]
for j in a:
	a_list.append(j)
for i in range (len(s)):
	ans.append(a_list[a_list.index(s[i])+n].upper())
print("".join(ans))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, S: str):
    print(''.join([chr((ord(i)+N-ord('A'))%26 + ord('A')) for i 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 = input()
ans = ''
for c in s:
    ans += chr(ord(c)+n) if ord(c)+n <= 90 else chr(ord(c)+n-90+64)
print(ans)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

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

n = ni()
s = input()
ans = ""
for i in range(len(s)):
    c = num2alpha(((alpha2num(s[i]) + n) % 26))
    if c != '@':
        ans += c
    else:
        ans += 'Z'


print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def convert(n):
  def _convert(c):
    ord_c = ord(c) + n
    ord_c = ord_c - 26 if ord_c > 90 else ord_c
    return chr(ord_c)
  return _convert

n = int(input())
s = input()
result = map(convert(n), list(s))
print(''.join(list(result)))

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
alpa=list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
for i in range(len(S)):
    for k in range(26):
        if S[i]==alpa[k]:
            S[i]=alpa[k+N]
            break
for n in range(len(S)):
    print(S[n],end="")

Submission status: Accepted

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

alphe = ['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'
         ]
beta = ['A','B','C','D','E','F','G','H',
         'I','J','K','L','M','N','O','P',
         'Q','R','S','T','U','V','W','X','Y','Z',
         'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
         'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
         'Q', 'R', 'S', 'T', 'U','V','W','X', 'Y', 'Z'
         ]

for i in range(len(S)):
    S[i]=beta[alphe.index(S[i])+N]

print(''.join(S))

Submission status: Accepted

Solution code:
import string
abc=string.ascii_uppercase
abc_l=[abc[i] for i in range(26)]
n=int(input())
a=input()
a_l=[a[_] for _ in range(len(a))]
for i in range(len(a)):
	new_index=(n+abc_l.index(a_l[i]))%26
	a_l[i]=abc_l[new_index]
print(''.join(a_l))

Submission status: Accepted

Solution code:
import string
n = int(input())
s = input()
s_ = ""
az = string.ascii_uppercase
for i in s:
    s_ += az[(az.index(i) + n)%len(az)]
print(s_)

Submission status: Accepted

Solution code:
alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
N = int(input())
S = list(input())
for i in range(len(S)):
    S[i] = alp[(alp.index(S[i])+N)%26]
print("".join(S))

Submission status: Accepted

Solution code:
import string

N=int(input())
S=input()
#N=2
#S='ABCXYZ'
ucase=string.ascii_uppercase
#print(ucase)
ucase=ucase+ucase
outstr=''
for x in S:
    p=ucase.find(x)+N
    outstr=outstr + ''.join(list(ucase)[p] )


print(outstr)