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

s = list(S)

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

result = ''
for i in s:
    num = dict1[i] + N
    if num > 26:
        num -= 26
    key = dict2[num]
    result += key

print(result)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
	N = int(input())
	S = list(str(input()))
	# print(S)

	al = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
	for i in range(0,len(S)):
		if al.index(S[i]) + N > 25:
			# print(al.index(S[i]))
			index = al.index(S[i])
			S[i] = al[index + N - 26]
		else:
			index = al.index(S[i])
			S[i] = al[index+N]
	print(''.join(map(str, S)))

Submission status: Accepted

Solution code:
# B - ROT N
N = int(input())
S = str(input())
####
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''
for s in S:
    alt_idx = chars.index(s) + N
    ans += chars[alt_idx]
print(ans)

Submission status: Accepted

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

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

for i in range(len(S)):
    if ap.index(S[i])<26-N:
        ans.append(ap[ap.index(S[i])+N])
    else:
        ans.append(ap[ap.index(S[i])+N-26])
print(''.join(ans))

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"]
l=len(s)
u=[]
for j in range(l):
    u.append(s[j])
for k in range(l):
    for h in range(26):
        if u[k]==alp[h]:
            u[k]=alp[(h+n)%26]
            break    
for b in range(l):
    print(u[b], end="")

Submission status: Accepted

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

import string
alphabet = list(map(chr, range(ord('A'), ord('Z')+1)))

ans = ''
for s in S:
  a = list(map(chr, range((ord(s)+N-ord('A')) % 26 + ord('A'),
                          (ord(s)+N-ord('A')) % 26 + ord('A')+1)))
  ans = ans + a[0]
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = input()
    S = S.lower()
    ans = []
    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 I in range(len(S)):
        X = A.index(S[I])
        if X + N >= 26:
            X = X - 26
        ans.append(A[X + N])

    answer = "".join(ans)
    answer = answer.upper()

    print(answer)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N=int(input())
S=input()
chars=list(S)
lista=[chr(ord(x)+N) if ord(x)+N < 91 else chr(ord(x)+N-26) for x in chars]
listb=''.join(lista)
print(listb)

Submission status: Accepted

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

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

for i in s:
    for j in range(len(al)):
        if i == al[j] and j + n < len(al):
            ans += al[j+n]
        elif i == al[j] and j + n > len(al)-1:
            ans += al[abs(len(al)-j-n)]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

abc =list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
rot = []
for s in S:
    for a in abc:
        if s == a:
            r = abc.index(a) + N
            if r >= 26:
                r = r - 26 
            rot.append(abc[r])
print("".join(rot))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n= int(input())
s= input()
a=""
for i in range(len(s)):
    if ord(s[i])+n<=90:
        a+=chr(ord(s[i])+n)
    else:
        a+=chr(ord(s[i])+n-26)

print(a)

Submission status: Accepted

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

for ch in c:
    if 'A' <= ch <= 'Z':
            answer += chr((ord(ch) - ord('A') + int(n)) % 26 + ord('A'))
print(answer)

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
ans = ""
for i in range(len(S)):
    ch = ord(S[i])+N
    if ch > ord('Z'): ch -= (ord('Z')-ord('A')+1)
    ans += chr(ch)
print(ans)

Submission status: Accepted

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

an = ord("A")

print("".join([chr((ord(c) - an + n) % 26 + an) for c in s]))

Submission status: Accepted

Solution code:
n=int(input())
inn = input()
# inn = input.lower()
output = []
for character in inn:
    number = ord(character) - 96
    output.append(number)
import numpy as np
x=np.array(output)
a=x+n
num2alpha = lambda c: chr(c+96)
y=[]
for i in range(len(a)):
	if a[i]>=-5:
		a[i]-=26
	# a[i]=num2alpha(int(a[i]))
	y.append(chr(int(a[i])+96))
# print(output)
print(''.join(map(str, y)))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
L = ""
def f(a):
    return chr((ord(a)+N)%90 + 64) 
  
for i in range(len(S)):
    if ord(S[i])+N>90:
        s = f(S[i])
    else:
        s = chr(ord(S[i])+N)
    L += s

print(L)

Submission status: Accepted

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


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

ans = []
for character in S:
  try:
    num = alpha2num(character)
    new_num = (num + N) % 26
    if new_num == 0:
      new_num = 26
    new_chr = num2alpha(new_num)
    ans.append(new_chr)
  except:
    break

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('A')+1)
    return num

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

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

ans = ''
for i in S:
    tmp = alpha2num(i)
    if tmp + N <= 26:
        ans += num2alpha(tmp+N)
    else:
        ans += num2alpha(tmp+N-26)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
ls = list(s)
la = [chr(i) for i in range(65, 65+26)]
lind = []
for i in range(len(s)):
    for j in range(len(la)):
        if ls[i] == la[j]:
            lind.append(la.index(la[j]))
            break
lans = [la[lind[i]-26+n] for i in range(len(s))]
ans = ''.join(lans)
print(ans)

Submission status: Accepted

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

for i in range(len(s)):
    if(l.index(s[i])+n >=26):
        num=l.index(s[i])+n-26
    else:
        num=l.index(s[i])+n
    new=new[:]+ l[num]
print(new)

Submission status: Accepted

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

char_after_n = {}


def get_nth_ascii(original_ascii, n):
    NUM_ASCII = 26
    c = original_ascii + (n % NUM_ASCII)
    if c > ord('Z'):
        return c - NUM_ASCII
    return c


# create map A to Z
for c in range(ord('A'), ord('Z') + 1):
    char_after_n[c] = get_nth_ascii(c, N)

for mapped_char in map(lambda s: chr(char_after_n[ord(s)]), S):
    print(mapped_char, end="")

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
n %= 26
alphabets = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','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']

m = len(s)

for i in range(m):
	for j in range(26):
		if s[i] == alphabets[j]:
			s[i] = alphabets[j+n]
			break
s = ''.join(s)
print(s)

Submission status: Accepted

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

for i in range(0,len(S)):
  for j in range(0,len(L)):
    if S[i] == L[j]:
      print(L[j-len(L)+N],end='')
      break

Submission status: Accepted

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

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


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

Submission status: Accepted

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

import math
import itertools

# 入力
N = int(input())
S = str(input())

dic = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

ans = ""
for i in range(len(S)) :
  for j in range(len(dic)) :
    if S[i] == dic[j] :
      ans += dic[j+N]
      break

print (ans)

Submission status: Accepted

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

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

result = caesar(S, -n)
print(result)

Submission status: Accepted

Solution code:
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd

def lcm(n,m):
    return int(n*m/gcd(n,m))

import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace

from queue import PriorityQueue as pq

def reduce(p, q):
    common = fractions.gcd(p, q)
    return (p//common , q//common )
# from itertools import accumulate
# from collections import deque

import random


def main():
    n = int(input())
    S = input().strip()
    SS=""
    SX="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    #eprint((ord("A")))
    #eprint((ord("Z")))
    for i in range(len(S)):
        # S[i] -> 
        # SX[i] -> SX[i+n]
        # ii = (i+n) % 25 
        # SS+=SX[ii]
        chrcode =  (ord(S[i]) + n) if (ord(S[i]) + n)<=90  else (ord(S[i]) + n)%91 + 65
        #eprint( chrcode )
        SS+= chr(chrcode)
    print(SS)
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
A_list = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

S_list = list(S)
ans = ""

for i in range(len(S_list)):
    for j in range(len(A_list)):
        if S_list[i] == A_list[j]:
            if (j + N) > 25:
                ans += A_list[j + N - 26]
            else:
                ans += A_list[j + N]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = 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','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]:
            ans += abc[j + n]
            break
        
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from itertools import product
from collections import Counter, defaultdict
from string import ascii_uppercase as ABC
#input = sys.stdin.readline
def inpl(): return list(map(int, input().split()))

N = int(input())
S = input()
ans = []
for s in S:
    ans.append(ABC[(ord(s)-65+N)%26])
print("".join(ans))

Submission status: Accepted

Solution code:
N = int(input().rstrip())
S = input().rstrip()
new_str = ''
for a in list(S):
    ascii_code = ord(a) + N
    ascii_code = (ascii_code - 26) if ascii_code > 90 else ascii_code
    new_str += chr(ascii_code)
print(new_str)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
MOJI0='ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
MOJI1=MOJI0[N:N+26]
ans=[]
for i in range(len(S)):
    pos=MOJI0.find(S[i])
    ans += MOJI1[pos]
ans = ''.join(ans)
   
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
def rot(s, num):
    ans = []
    for i in range(len(s)):
        temp = ord(s[i])
        if 65 <= temp + num <= 90:
            ans.append(chr(temp + num))
        else:
            ans.append(chr(65 + (temp + num) - 91))
    temp_ans = "".join(ans)
    return temp_ans
print(rot(s = S, num = N))

Submission status: Accepted

Solution code:
N = int(input())

str = input()

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

str_arr = list(str)

length = len(str_arr)

for i in range(length):
  a = str_arr[i]
  b = arr.index(a)
  c = b + N
  ans = ans + arr[c]
  
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','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']

ans =[]

for i in range(len(S)):
    for j in range(26):
        if S[i] == alpha[j]:
            ans.append(alpha[j+N])

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

Submission status: Accepted

Solution code:
n=int(input())
l=str(input())
#print(type(l))

ll=[]
leng=len(l)
#print('leng is %d'%leng)
for i in range(leng):
    t=l[i]
    tt=(ord(t)-ord('A')+1+n)%26
    if tt==0:
        tt+=26
    ttt=chr(tt+64)
    ll.append(ttt)
print(*ll,sep='')

Submission status: Accepted

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

n_s = ""

for c in s:
    add = n
    c_num = ord(c) - 64
    if(n % 26 == 0):
        n_s += c
    else:
        if(c_num + n > 26):
            add = (c_num + n) % 26
            n_s += chr(add + 64)
        else:
            n_s += chr(c_num + add + 64)

print(n_s)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
S = input()

moji_list = []

q, mod = divmod(N, 26)
for i in range(len(S)):
  if (ord(S[i])+mod) <= 90:
    moji_list.append(chr(ord(S[i]) + mod))
  else:
    moji_list.append(chr(ord(S[i]) + mod - 26))
    
  
print("".join(moji_list))

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
S_new=[]
for i in S:
    S_new.append(alphabet[(alphabet.index(i)+ N)%26] )
print(''.join(S_new))

Submission status: Accepted

Solution code:
n =int(input())
s = list(map(str,input()))
l=[]
for i in range(len(s)):
    if ord(s[i])>=91-n:
        l.append(chr((ord(s[i])-26+n)))
    else:
        l.append(chr((ord(s[i])+n)))

print(''.join(l))

Submission status: Accepted

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

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

for i in S:
    box.append(string.index(i) + N)


for i in box:
    print(string[i], end="")

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 = [0]*len(s)
for i in range(len(s)):
    S = s[i]
    key = (alphabet.index(S))
    ans[i] = alphabet[(key+n)%26]
print("".join(ans))

Submission status: Accepted

Solution code:

N = int(input())
S = input()
ans = []
for i, c in enumerate(S):
    num = ord(c) + N
    if num > ord('Z'):
        num -= 26
    ans.append(chr(num))
print(''.join(ans))

Submission status: Accepted

Solution code:
X = int(input())
A = input()

char_list = list(A)

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

for item in char_list:
    num = alpha2num(item)+X
    if num > 26: 
       char = char + num2alpha(num-26)
    else:
       char = char + num2alpha(num)

print(char)

Submission status: Accepted

Solution code:
# coding UTF-8
# 
# problem B
# 

import numpy as np

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

ords = np.array([ord(x) for x in s])
after_ords = ords + n
after_ords[after_ords >= 91] = after_ords[after_ords >= 91] + 6
print(str.upper(''.join([chr(a) for a in after_ords])))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
alpha = list("ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ")
i = 0
while i < len(s):
  j = 0
  while j < 26:
    if s[i] == alpha[j]:
      s[i] = alpha[j+n]
      break
    else:j += 1
  i += 1

k = 0
while k < len(s) :
  print(s[k],end ="")
  k += 1

Submission status: Accepted

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

word1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
word2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
ans = ''

for i in range(len(S)):
    for j in range(len(word1)):
        if S[i]==word1[j]:
            ans = ans + word2[j+N]
            
print(ans)

Submission status: Accepted

Solution code:
n = int(input())%26
alp = list(input())

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

for i in range(0,len(alp)):
    num.append(alpha2num(alp[i]))
    num[i]+=n
    if num[i]>26:
        num[i]=num[i]-26
    alp[i]=num2alpha(num[i])

ans = "".join(alp)
print(ans)

Submission status: Accepted

Solution code:
import string
import numpy as np

alist=np.asarray(list(string.ascii_uppercase)) # アルファベットのリスト
N=int(input()) # 何個ずらすか
S=input() # 入力の文字列
O="" # 出力の文字列

# 各文字について
for s in S:
    aconv=alist[(np.where(alist==s)[0][0]+N)%26] # 変換した後の文字
    O+=aconv # 連結

print(O)

Submission status: Accepted

Solution code:
L="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
n=int(input())
s=input()
i=0
for j in s:
    print(s.replace(j,L[(L.index(j)+n)%26])[i],end="")
    i += 1

Submission status: Accepted

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

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

i = 0
j = 0

while i < len(Slist):
    while j < len(al):
        if Slist[i] == al[j]:
            if j+N > len(al)-1:
                Slist[i] = al[j+N-26]
                break
            Slist[i] = al[j+N]
            break
        j += 1
    i += 1
    j = 0

Sprint = ''.join(Slist)

print(Sprint)

Submission status: Accepted

Solution code:
n = int(input())
string = list(input())
#print(ord("Z"))
for e,i in enumerate(string):
    val = ord(str(i)) + n
    if (val > 90):
        val = 64 + (val - 90)
    string[e] = chr(val)
mojiretu = ''
for x in string:
    mojiretu += x
    
print(mojiretu)
#print(str(string))

Submission status: Accepted

Solution code:
import numpy as np
N = input()
N = int(N)
S = input()
S = list(S)
data = np.array(["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)):
  idx = np.where(data == S[i])[0]
  out += data[int((idx + N) % 26)]

print(out)

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input().rstrip())
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",
"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 , alphabet_name in enumerate(s):
    s[i] = alphabet[ (alphabet.index(s[i])) +n]
    
print("".join(s))

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"]
temp = []
ans = ""

for i in range(len(S)):
    su = L.index(S[i])+N
    if su >=26:
        su -= 26
    temp.append(su)
for j in range(len(S)):
    ans += L[int(temp[j])]
    
print(ans)

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

def rot(s, n):
	c = (rot_n(c, n) for c in s)
	print("".join(c))


n = int(input())
s = input()
rot(s, n)

Submission status: Accepted

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

O = []
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"]

for i in range(len(S)):
    for j in range(len(l)):
        if l[j] == S[i]:
            if (j + N) < 26:
                O.append(l[j+N])
            else:
                O.append(l[j+N-26])

string="".join(O)
print(string)

Submission status: Accepted

Solution code:
li = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

x = int(input())
list_before = input()

list_after = []
count = 0

for i in list_before:
    count = int(list.index(i)) + x
    while count >= 26:
        count -= 26

    list_after.append(list[count])

moji = ''.join(list_after)
print(moji)

Submission status: Accepted

Solution code:
ALPHABETS = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
size = len(ALPHABETS)
N = input()
S = input()
converted = map(lambda x: ALPHABETS[(ALPHABETS.index(x) + int(N)) % size], list(S))
print(''.join(converted))

Submission status: Accepted

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

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

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)    
    else:
        return num2alpha(num%26)

ans = []
for i in range(len(s_list)):
    num_ = alpha2num(s_list[i])
    if (num_ + n) %26 != 0:
        ans.append(num2alpha(num_ + n))
    else:
        ans.append('Z')

ans_str = ''

if n == 0:
    for i in range(len(s_list)):
        ans_str += s_list[i]
    print(ans_str)
else:
    for i in range(len(ans)):
        ans_str += ans[i]
    print(ans_str)

Submission status: Accepted

Solution code:
Num=int(input())
String=input()
Library=[['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]]
newstring=''
for i in String:
    for j in range(0,26):
        if i==Library[j][0]:
            oldstring=newstring
            newstring=oldstring+Library[(j+Num)%26][0]
print(newstring)

Submission status: Accepted

Solution code:
kotae=[]
N = int(input())
Sst=input()
S = list(Sst)
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','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']

for i in range(len(Sst)):
    for j in range(26):
        if S[i] == L[j]:
            kotae.append(L[j+N])

Sed = "".join(kotae)
print(Sed)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
H = ""
A = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"

if(N==0):
  print(S)
else:
  for i in range(len(S)):
    for j in range(26):
      if(S[i]==A[j]):
        H += A[j+N]
  print(H)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
l="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
ans=""
for i,j in enumerate(s):
  ides=l.find(j)
  if ides+n>25:
    ides-=26
  #print(i,j)
  ans+=l[ides+n]
print(ans)

Submission status: Accepted

Solution code:
import sys

N = int(input())
S = input()
RES = ''

for i in range(len(S)):
    if ord(S[i]) + N - 64 > 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=["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=[["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","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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
   ["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"],
  ]
c=[]
for i in  range(len(s)):
    cnt=a.index(s[i])
    c.append(str(b[cnt][n%26]))
for i in range(len(s)):
    print(c[i],end="")

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
import re

def solve(N: int, S: str):
    dic_original = ["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:
        s_r = dic_original[(dic_original.index(s) + N) % 26]
        ans += s_r
#        S_ = re.sub(s, s_r, S)
    print(ans)

def main():
    N = int(input())
    S = str(input())
    solve(N, S)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

lst = [chr(ord('a') + i) for i in range(26)]
lst_up = list(map(str.upper,lst))

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

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

Submission status: Accepted

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

outS = ""
for i in range(len(S)):
    ASCII = ord(S[i])
    ASCII += N
    if ASCII > 90:
        ASCII = 65  + int(ASCII % 91)
    outS += chr(ASCII)
print(outS)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
alphas = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
for s in S:
  i = alphas.index(s)
  print(alphas[i+N], end='')

Submission status: Accepted

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

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

Submission status: Accepted

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

#文字列をリストに変換
s=[]
for i in range(len(S)):
    s.append(S[i])


#アルファベットを26で割ったあまりの数で対応させるためのリスト
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"]
#置き換え後の文字列の番号のリスト
number=[]
for i in s:
    number.append(alphabet.index(i)+N)

#番号から文字を特定し一つずつ表示
for i in number:
    ans=alphabet[i%26]
    print(ans,end="")

Submission status: Accepted

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

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

O = "".join(ns)
print(O)