Julius Caesar protected his confidential information by encrypting it using a cipher. Caesar's cipher shifts each letter by a number of letters.  If the shift takes you past the end of the alphabet, just rotate back to the front of the alphabet.  In the case of a rotation by 3, w, x, y and z would map to z, a, b and c.

Original alphabet:      abcdefghijklmnopqrstuvwxyz
Alphabet rotated +3:    defghijklmnopqrstuvwxyzabc

Example 

$s=\textbf{There's-a-star-waiting-in-the-sky}$ 

$k=3$  

The alphabet is rotated by $3$, matching the mapping above.  The encrypted string is $\textbf{Wkhuh'v-d-vwdupdq-zdlwlqj-lq-wkh-vnb}$.  

Note: The cipher only encrypts letters; symbols, such as -, remain unencrypted.  

Function Description  

Complete the caesarCipher function in the editor below.  

caesarCipher has the following parameter(s):

string s: cleartext  
int k: the alphabet rotation factor  

Returns  

string:  the encrypted string  

Input Format

The first line contains the integer, $n$, the length of the unencrypted string. 

The second line contains the unencrypted string, $\boldsymbol{\mathrm{~S~}}$. 

The third line contains $\boldsymbol{\mbox{k}}$, the number of letters to rotate the alphabet by.

Constraints

$1\leq n\leq100$ 

$0\leq k\leq100$ 

$\boldsymbol{\mathrm{~S~}}$ is a valid ASCII string without any spaces.   

Sample Input
11
middle-Outz
2

Sample Output
okffng-Qwvb

Explanation
Original alphabet:      abcdefghijklmnopqrstuvwxyz
Alphabet rotated +2:    cdefghijklmnopqrstuvwxyzab

m -> o
i -> k
d -> f
d -> f
l -> n
e -> g
-    -
O -> Q
u -> w
t -> v
z -> b

Difficulty: EASY
Tags: String algorithms

Starter code:

Solutions:
cnt = int(input())
string = input()
shift = int(input())
res = ''
while shift > 26:
	shift -= 26
for char in string:
	if char.isalpha():
		is_upper = False
		is_lower = False
		if ord(char) < 95:
			is_upper = True
		else:
			is_lower = True
		ascii_new = ord(char) + shift
		if is_upper and ascii_new > 90:
			ascii_new = ascii_new - 26
		if is_lower and ascii_new > 122:
			ascii_new = ascii_new - 26
		res += chr(ascii_new)
	else:
		res += char
print(res)


def main():
	l = input()
	st = input()
	s = int(input())
	l_s = [chr(i) for i in range(ord('a'), ord('z') + 1)]
	l_b = [chr(i) for i in range(ord('A'), ord('Z') + 1)]
	cpy = ''
	for i in st:
		if i in l_s:
			cpy += l_s[(l_s.index(i) + s) % 26]
		elif i in l_b:
			cpy += l_b[(l_b.index(i) + s) % 26]
		else:
			cpy += i
	print(cpy)
main()


def cipher(string, k):
	alphabet_low = ['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']
	alphabet_big = ['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']
	chars = list(string)
	output_string = ''
	for char in chars:
		if char in alphabet_low:
			index = alphabet_low.index(char) + k
			n = len(alphabet_low)
			while index >= n:
				index -= n
			char = alphabet_low[index]
		elif char in alphabet_big:
			index = alphabet_big.index(char) + k
			n = len(alphabet_big)
			while index >= n:
				index -= n
			char = alphabet_big[index]
		output_string += char
	return output_string
length = int(input())
string = input()
k = int(input())
print(cipher(string, k))


l = int(input())
s = input()
k = int(input())
for i in range(l):
	if ord(s[i]) in range(97, 123):
		print(chr((ord(s[i]) - 97 + k) % 26 + 97), end='')
	elif ord(s[i]) in range(65, 91):
		print(chr((ord(s[i]) - 65 + k) % 26 + 65), end='')
	else:
		print(s[i], end='')


from string import ascii_lowercase as l, ascii_uppercase as u
input()
a = input()
b = int(input())
c = ''
for i in a:
	if i in l:
		c += l[(l.index(i) + b) % 26]
	elif i in u:
		c += u[(u.index(i) + b) % 26]
	else:
		c += i
print(c)


strLength = int(input())
string = input()
shift = int(input())

def applyShift(ch):
	if 'a' <= ch and 'z' >= ch:
		return chr((ord(ch) - ord('a') + shift) % 26 + ord('a'))
	elif 'A' <= ch and 'Z' >= ch:
		return chr((ord(ch) - ord('A') + shift) % 26 + ord('A'))
	else:
		return ch
print(''.join(list(map(applyShift, string))))


def encrypt(str, k):
	a = ord('a')
	z = ord('z')
	A = ord('A')
	Z = ord('Z')
	secret = ''
	for c in str:
		x = ord(c)
		if x >= a and x <= z:
			x = (x - a + k) % 26 + a
		elif x >= A and x <= Z:
			x = (x - A + k) % 26 + A
		secret += chr(x)
	return secret

def main():
	input()
	s = input()
	k = int(input())
	print(encrypt(s, k))
main()


N = int(input())
a = list(input())
K = int(input())
for i in range(0, N):
	lower = 'abcdefghijklmnopqrstuvwxyz'
	upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	if a[i] in list(lower):
		a[i] = lower[(list(lower).index(a[i]) + K) % 26]
	elif a[i] in list(upper):
		a[i] = upper[(list(upper).index(a[i]) + K) % 26]
print(''.join(a))


str_len = int(input())
unencrypted = input()
rotate = int(input())
from string import ascii_lowercase
from string import ascii_uppercase
lowers = ascii_lowercase
uppers = ascii_uppercase
encrypted = ''
for i in range(0, str_len):
	if unencrypted[i] in lowers:
		lowers_1 = lowers.index(unencrypted[i])
		encrypted += lowers[(lowers_1 + rotate) % 26]
	elif unencrypted[i] in uppers:
		uppers_1 = uppers.index(unencrypted[i])
		encrypted += uppers[(uppers_1 + rotate) % 26]
	else:
		encrypted += unencrypted[i]
print(encrypted)


N = int(input())
st = input()
K = int(input())
result = ''
for i in st:
	if 65 <= ord(i) <= 90:
		s = chr((ord(i) + K - 65) % 26 + 65)
	elif 97 <= ord(i) <= 122:
		s = chr((ord(i) + K - 97) % 26 + 97)
	else:
		s = i
	result += s
print(result)


n = int(input())
s = input()
k = int(input())
f = []
for i in range(n):
	c = s[i]
	p = ord(c)
	if c.isalpha():
		if p < 96:
			d = 64
		else:
			d = 96
		p -= d
		p = (p + k - 1) % 26 + 1
		p += d
	f.append(p)
print(''.join((chr(i) for i in f)))


def encode(letter, K):
	Hash = {'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}
	codeHash = {0: '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'}
	try:
		hashValue = Hash[letter]
		newValue = (hashValue + K) % 26
		return codeHash[newValue]
	except:
		return letter
N = int(input())
msg = input()
K = int(input())
coded_msg = ''
for i in range(N):
	if msg[i].isupper():
		temp = msg[i].lower()
		temp = encode(temp, K)
		temp = temp.upper()
	else:
		temp = msg[i]
		temp = encode(temp, K)
	coded_msg = coded_msg + temp
print(coded_msg)


n = int(input())
s = input()
k = int(input())
ans = ''
(aA, aa) = (ord('A'), ord('a'))
for ch in s:
	if ch.isupper():
		ch = chr((ord(ch) - aA + k) % 26 + aA)
	elif ch.islower():
		ch = chr((ord(ch) - aa + k) % 26 + aa)
	ans += ch
print(ans)


N = int(input())
S = input()
K = int(input())
newS = ''
for c in S:
	if c.isalpha():
		if c.islower():
			c = chr(ord(c) + K % 26)
			if c > 'z':
				c = chr(ord(c) - 26)
		else:
			c = chr(ord(c) + K % 26)
			if c > 'Z':
				c = chr(ord(c) - 26)
	newS += c
print(newS)


siz = int(input())
inp = input()
jumper = int(input())
jumper %= 26
out = ''
for i in range(0, siz):
	a = inp[i]
	if a >= chr(97) and a <= chr(122):
		t = ord(a) + jumper
		if t > 122:
			t -= 26
		out += chr(t)
	elif a >= chr(65) and a <= chr(90):
		t = ord(a) + jumper
		if t > 90:
			t -= 26
		out += chr(t)
	else:
		out += a
print(out)


n = int(input())
msg = input()
dial = int(input()) % 26
a = 'abcdefghijklmnopqrstuvwxyz'
A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
crypto = ''
for s in msg:
	if s.isupper():
		alphabet = A
	else:
		alphabet = a
	if s in alphabet:
		try:
			crypto = crypto + alphabet[alphabet.find(s) + dial]
		except:
			r = alphabet.find(s) + dial - len(alphabet)
			crypto = crypto + alphabet[r]
	else:
		crypto = crypto + s
print(crypto)


n = int(input())
s = input()
k = int(input())
a = []
k = k % 26
for v in s:
	if v >= 'A' and v <= 'Z':
		v = chr(ord(v) + k)
		if v > 'Z':
			v = chr(ord(v) - 26)
	elif v >= 'a' and v <= 'z':
		v = chr(ord(v) + k)
		if v > 'z':
			v = chr(ord(v) - 26)
	a.append(v)
print(''.join(a))


input()
s = input()
k = int(input())
charA = ord('A')
charZ = ord('Z')
chara = ord('a')
charz = ord('z')
for c in s:
	char = ord(c)
	isletter = char >= charA and char <= charZ or (char >= chara and char <= charz)
	if isletter:
		maxchar = charz if char >= chara else charZ
		newchar = char + k
		while newchar > maxchar:
			newchar -= 26
		print(chr(newchar), end='')
	else:
		print(c, end='')
print('')


N = int(input())
string = list(input())
addNum = int(input())
length = len(string)
for i in range(length):
	if ord(string[i]) <= ord('Z') and ord(string[i]) >= ord('A'):
		asciiCode = ord(string[i]) + addNum
		while asciiCode > ord('Z'):
			asciiCode = asciiCode - ord('Z') + ord('A') - 1
		string[i] = chr(asciiCode)
	elif ord(string[i]) <= ord('z') and ord(string[i]) >= ord('a'):
		asciiCode = ord(string[i]) + addNum
		while asciiCode > ord('z'):
			asciiCode = asciiCode - ord('z') + ord('a') - 1
		string[i] = chr(asciiCode)
print(''.join(string))


n = int(input())
s = input()
k = int(input())
for i in s:
	if ord(i) >= 65 and ord(i) <= 90:
		print(chr((ord(i) - 65 + k) % 26 + 65), end='')
	elif ord(i) >= 97 and ord(i) <= 122:
		print(chr((ord(i) - 97 + k) % 26 + 97), end='')
	else:
		print(i, end='')


import string
steps = {x: chr(ord(x) + 1) for x in string.ascii_letters}
steps['z'] = 'a'
steps['Z'] = 'A'
length = int(input())
text = input()
shift = int(input())
for i in range(0, shift):
	text = ''.join([steps[x] if x in steps else x for x in text])
print(text)


def rotate_char(c, k):
	value = ord(c)
	if ord('A') <= value <= ord('Z'):
		return chr((ord(c) - ord('A') + k) % 26 + ord('A'))
	elif ord('a') <= value <= ord('z'):
		return chr((ord(c) - ord('a') + k) % 26 + ord('a'))
	else:
		return c
_ = input()
s = input()
k = int(input())
print(''.join([rotate_char(c, k) for c in s]))


key = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
l = int(input())
inpt = input()
n = int(input())
ans = ''
while n >= 26:
	n = n - 26
for c in range(0, l):
	d = key.find(inpt[c:c + 1])
	if d > -1:
		ans = ans + key[d + n]
	else:
		ans = ans + inpt[c:c + 1]
print(ans)


N = int(input())
S = input()
limit = 0
K = int(input())
if K > 26:
	K = K % 26
S2 = ''
for i in S:
	if i.isupper():
		limit = 90
	if i.islower():
		limit = 122
	if i.isalpha():
		num = ord(i) + K
		if num > limit:
			num -= 26
		S2 = S2 + chr(num)
	else:
		S2 = S2 + i
print(S2)


n = int(input())
mstr = input()
k = int(input())
ans = list()
for i in range(0, n):
	x = ord(mstr[i])
	if x >= 65 and x <= 90 or (x >= 97 and x <= 122):
		temp = x + k
		if temp > 90 and (x >= 65 and x <= 90):
			x = x + k % 26
			if x > 90:
				x -= 26
		elif temp > 122 and (x >= 97 and x <= 122):
			x = x + k % 26
			if x > 122:
				x -= 26
		else:
			x += k
		ans.append(chr(x))
	else:
		ans.append(mstr[i])
print(''.join(ans))


import string

def caesar(char, shift):
	if char in string.ascii_lowercase:
		return string.ascii_lowercase[(string.ascii_lowercase.index(char) + shift) % 26]
	if char in string.ascii_uppercase:
		return string.ascii_uppercase[(string.ascii_uppercase.index(char) + shift) % 26]
	return char
length = input()
plain = input()
shift = int(input())
encrypted = ''.join([caesar(char, shift) for char in plain])
print(encrypted)


def cipher(s, k):
	out = ''
	for i in s:
		asc = ord(i)
		if 65 <= asc <= 90:
			if asc + k > 90:
				diff = (asc + k - 90) % 26
				if diff == 0:
					out += chr(90)
				else:
					out += chr(64 + diff)
			else:
				out += chr(asc + k)
		elif 97 <= asc <= 122:
			if asc + k > 122:
				diff = (asc + k - 122) % 26
				if diff == 0:
					out += chr(122)
				else:
					out += chr(96 + diff)
			else:
				out += chr(asc + k)
		else:
			out += i
	return out
n = int(input())
s = input()
k = int(input())
print(cipher(s, k))


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

def encode(s, k):
	abc = 'abcdefghijklmnopqrstuvwxyz'
	ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	es = ''
	for c in s:
		if ABC.find(c) != -1:
			es += ABC[(ABC.find(c) + k) % len(ABC)]
		elif abc.find(c) != -1:
			es += abc[(abc.find(c) + k) % len(abc)]
		else:
			es += c
	return es
print(encode(s, k))


n = int(input())
s = input()
k = int(input())
k = k % 26
for i in range(n):
	j = ord(s[i])
	if j >= 65 and j <= 90 or (j >= 97 and j <= 122):
		if j >= 65 and j <= 90:
			j = j + k
			if j > 90:
				j = 64 + j - 90
		elif j >= 90 and j <= 122:
			j = j + k
			if j > 122:
				j = 96 + j - 122
		print(chr(j), end='')
	else:
		print(s[i], end='')


def encrypt():
	l = int(input())
	s = input()
	key = int(input())
	s1 = ''
	for i in s:
		a = ord(i)
		if a > 96 and a < 123:
			s1 += chr((a % 97 + key) % 26 + 97)
		elif a > 64 and a < 91:
			s1 += chr((a % 65 + key) % 26 + 65)
		else:
			s1 += chr(a)
	return s1
print(encrypt())


def isLetter(c):
	return 'a' <= c and c <= 'z' or ('A' <= c and c <= 'Z')

def isLower(c):
	return 'a' <= c and c <= 'z'

def toLower(c):
	if isLower(c):
		return c
	return chr(ord(c) - 32)

def toUpper(c):
	if not isLower(c):
		return c
	return chr(ord(c) + 32)

def rotate(c, k):
	k = k % 26
	if not isLetter(c):
		return c
	if isLower(c):
		res = ord(c) - 97
		res = (res + k) % 26
		return chr(res + 97)
	else:
		res = ord(c) - 65
		res = (res + k) % 26
		return chr(res + 65)
n = int(input())
s = input()
k = int(input())
for x in s:
	print(rotate(x, k), end='')
print()


n = int(input())
string = input()
string = string
k = int(input())
listOfCharacters = list(string.lower())
listOfOrignalCharaters = list(string)
listOfOrds = []
finalString = []
for each_character in listOfCharacters:
	if str(each_character).isalpha():
		if k > 26:
			k = k % 26
		a = ord(each_character) + k
		if a > 122:
			rem = a - 122
			a = 97 + rem - 1
		listOfOrds.append(a)
	else:
		listOfOrds.append(ord(each_character))
for each_ord in listOfOrds:
	finalString.append(chr(each_ord))
for each_character in listOfOrignalCharaters:
	if str(each_character).isupper():
		index = listOfOrignalCharaters.index(each_character)
		listOfOrignalCharaters[index] = '1'
		finalString[index] = str(finalString[index]).capitalize()
ansString = ''.join(finalString)
print(ansString)


import fileinput
input_list = []
for line in fileinput.input():
	input_list.append(str(line))
N = int(input_list[0])
string = input_list[1][:-1]
K = int(input_list[2]) % 26
encrypted = ''

def cipher(n):
	result = n
	if n >= 65 and n + K <= 90 or (n >= 97 and n + K <= 122):
		result += K
	elif n >= 65 and n <= 90 and (n + K > 90) or (n >= 97 and n <= 122 and (n + K > 122)):
		result += -26 + K
	return result
for x in range(N):
	n = ord(string[x])
	encrypted += chr(cipher(n))
print(encrypted)


import string, sys
N = int(sys.stdin.readline())
S = sys.stdin.readline().strip()
K = int(sys.stdin.readline())
chars = string.ascii_lowercase
cipher = chars[K % 26:] + chars[:K % 26]
print(S.translate(str.maketrans(chars + chars.upper(), cipher + cipher.upper())))


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

def rot(x):
	A = ord('A')
	a = ord('a')
	z = ord('z') - a + 1
	if not x.isalpha():
		return x
	if x == x.lower():
		return chr(a + (ord(x) - a + K) % z)
	return chr(A + (ord(x) - A + K) % z)
print(''.join((rot(x) for x in S)))


length = int(input())
string = input()
k = int(input()) % 26
answer = []
for each in string:
	if each.isalpha():
		val = ord(each)
		if val >= 65 and val <= 90:
			if val + k > 90:
				val = val + k - 26
			else:
				val += k
		elif val >= 97 and val <= 122:
			if val + k > 122:
				val = val + k - 26
			else:
				val += k
		answer += chr(val)
	else:
		answer += each
print(''.join(answer))


n = input()
string = input()
k = int(input()) % 26
encrypted = []
for character in string:
	if character.isalpha():
		if character.isupper():
			startIndex = ord('A')
		else:
			startIndex = ord('a')
		difference = ord(character) - startIndex
		encrypted.append(chr((difference + k) % 26 + startIndex))
	else:
		encrypted.append(character)
print(''.join(encrypted))


n = int(input())
st = input()
k = int(input())
res = ''
for i in st:
	if 65 <= ord(i) <= 90:
		res += chr((ord(i) - 65 + k) % 26 + 65)
	elif 97 <= ord(i) <= 122:
		res += chr((ord(i) - 97 + k) % 26 + 97)
	else:
		res += i
print(res)


l = int(input())
s = list(input())
k = int(input())
k = k % 26
for i in range(0, l):
	char = s[i]
	key = ord(char)
	n_key = key + k
	if key not in range(65, 91) and key not in range(97, 123):
		continue
	if key in range(65, 91) and (not 65 <= n_key <= 90):
		s[i] = chr(n_key - 90 + 64)
	elif key in range(65, 91) and n_key in range(65, 91):
		s[i] = chr(n_key)
	elif key in range(97, 123) and n_key not in range(97, 123):
		s[i] = chr(n_key - 122 + 96)
	elif key in range(97, 123) and n_key in range(97, 123):
		s[i] = chr(n_key)
print(''.join(s))


letters = int(input())
message = input()
rotate = int(input()) % 26
encrypted = ''
for l in message:
	dec = ord(l)
	rot = dec + rotate
	if dec >= 65 and rot <= 90:
		encrypted += chr(rot)
		continue
	elif dec <= 90 and rot >= 90:
		encrypted += chr(64 + rotate - (90 - dec))
		continue
	if dec >= 97 and rot <= 122:
		encrypted += chr(rot)
		continue
	elif dec <= 122 and rot >= 122:
		encrypted += chr(96 + rotate - (122 - dec))
		continue
	encrypted += l
print(encrypted)


size = int(input())
st = input()
k = int(input())

def isLarge(c):
	if c >= 'A' and c <= 'Z':
		return True
	else:
		return False

def isSmall(c):
	if c >= 'a' and c <= 'z':
		return True
	else:
		return False

def round_large(value):
	if value <= ord('Z'):
		return value
	else:
		value -= ord('A')
		value %= ord('Z') - ord('A') + 1
		value += ord('A')
	return value

def round_small(value):
	if value <= ord('z'):
		return value
	else:
		value -= ord('a')
		value %= ord('z') - ord('a') + 1
		value += ord('a')
	return value
res = ''
for i in range(len(st)):
	c = st[i]
	if isLarge(c):
		value = ord(c)
		value += k
		value = round_large(value)
		c = chr(value)
	elif isSmall(c):
		value = ord(c)
		value += k
		value = round_small(value)
		c = chr(value)
	res += c
print(res)


import string
stringLength = input()
myWord = input()
shift = int(input())
alphabet = list(string.ascii_lowercase)
alphabetU = list(string.ascii_uppercase)
for letter in myWord:
	upper = 0
	ind = string.ascii_lowercase.find(letter)
	if ind < 0:
		ind = string.ascii_uppercase.find(letter)
		upper = 1
	if ind < 0:
		newLetter = letter
	elif upper == 0:
		newLetter = alphabet[(ind + shift) % 26]
	else:
		newLetter = alphabetU[(ind + shift) % 26]
	print(newLetter, end='')


t = int(input())
s = input()
o = int(input()) % 26

def Trans(a):
	if a.isalpha():
		c = a.islower()
		d = ord(a.upper()) + o
		if d > ord('Z'):
			d -= 26
		k = str(chr(d))
		if c:
			k = k.lower()
	else:
		return a
	return k
print(''.join(list(map(Trans, s))))


def rotate(letter, rotate_by):
	ascii_val = ord(letter)
	if ascii_val >= 65 and ascii_val < 91:
		ascii_val -= 65
		ascii_val = (ascii_val + rotate_by) % 26
		return chr(ascii_val + 65)
	elif ascii_val >= 97 and ascii_val < 123:
		ascii_val -= 97
		ascii_val = (ascii_val + rotate_by) % 26
		return chr(ascii_val + 97)
	else:
		return letter

def encrypted_string(s, k):
	ret_val = [rotate(i, k) for i in list(s)]
	return ''.join(ret_val)
length_of_string = int(input())
orig_str = input()
rotate_by = int(input())
print(encrypted_string(orig_str, rotate_by))


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

def rotate(c, k):
	if c.isupper():
		base = 'A'
	else:
		base = 'a'
	return chr(ord(base) + (ord(c) - ord(base) + k) % 26)
encrypted = ''
for c in s:
	if c.isalpha():
		c = rotate(c, k)
	encrypted += c
print(encrypted)


def encrypt(s, slen, move):
	result = ''
	for char in s:
		base = -1
		if char.islower():
			base = ord('a')
			char_pos = ord(char)
		elif char.isupper():
			base = ord('A')
			char_pos = ord(char)
		else:
			pass
		if base != -1:
			diff = char_pos - base
			next_char = base + (diff + move) % 26
			result += chr(next_char)
		else:
			result += char
	return result
N = int(input().strip())
sentence = input().strip()
move = int(input().strip())
result = encrypt(sentence, N, move)
print(result)


import re
from collections import deque
length = int(input())
s = list(input())
cip = int(input())
l = deque()
for i in range(26):
	l.append(i)
l.rotate(-(cip % 26))
c = []
for i in s:
	if re.search('[A-Z]', i):
		a = ord(i) - ord('A')
		c.append(chr(l[a] + ord('A')))
	elif re.search('[a-z]', i):
		a = ord(i) - ord('a')
		c.append(chr(l[a] + ord('a')))
	else:
		c.append(i)
print(''.join(c))


def rotatechar(c, k):
	capital = c.isupper()
	c = c.lower()
	chars = ['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(0, len(chars)):
		if c == chars[i]:
			return chars[(i + k) % len(chars)].upper() if capital else chars[(i + k) % len(chars)]
	return c
n = int(input())
inputstr = input()
k = int(input())
output = [rotatechar(c, k) for c in inputstr]
output = ''.join(output)
print(output)


n = int(input())
s = input()
k = int(input()) % 26
alphabet = 'abcdefghijklmnopqrstuvwxyz'
rotated = alphabet[k:] + alphabet[:k]
upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ru = upper[k:] + upper[:k]
out = []
for letter in s:
	if letter in alphabet:
		out.append(rotated[alphabet.index(letter)])
	elif letter in upper:
		out.append(ru[upper.index(letter)])
	else:
		out.append(letter)
print(''.join(out))


length = input()
string = input()
shift = int(input())
cipher = ''
for l in string:
	if l.isalpha():
		a = ord('a')
		if l.isupper():
			a = ord('A')
		c = ord(l) - a
		cipher += chr((c + shift) % 26 + a)
	else:
		cipher += l
print(cipher)


n = int(input())
s = input().strip()
k = int(input())
f = ''

def caeser(c):
	if not c.isalpha():
		return c
	if ord(c) >= 97:
		return chr(97 + (ord(c) - 97 + k) % 26)
	return chr(65 + (ord(c) - 65 + k) % 26)
for i in range(len(s)):
	f += caeser(s[i])
print(f)


n = int(input())
msg = input()
k = int(input())
k = k % 26
for c in msg:
	if ord(c) > 96 and ord(c) < 123:
		buff = ord(c) + k
		if buff >= 123:
			buff -= 26
			print(chr(buff), end='')
		else:
			print(chr(ord(c) + k), end='')
	elif ord(c) > 64 and ord(c) < 91:
		buff = ord(c) + k
		if buff >= 91:
			buff -= 26
			print(chr(buff), end='')
		else:
			print(chr(ord(c) + k), end='')
	else:
		print(c, end='')


n = int(input())
a = input()
a = list(a)
b = int(input())
g = []
dict = {'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, '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}
dict1 = {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'}
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'}
for x in range(0, n):
	if a[x].isalpha():
		p = dict[a[x]]
		s = p + b
		while s > 26:
			s = s - 26
		if a[x].islower():
			k = dict1[s]
			g.append(k)
		else:
			k = dict2[s]
			g.append(k)
	else:
		p = a[x]
		g.append(p)
print(''.join((str(e) for e in g)))


n = int(input())
s = list(input())
k = int(input())
for t in range(n):
	if s[t].isalpha():
		s[t] = chr((ord(s[t]) - (ord('A') if s[t].isupper() else ord('a')) + k) % 26 + (ord('A') if s[t].isupper() else ord('a')))
[print(t, end='') for t in s]


def encode(m, key):
	res = ''
	for c in m:
		if c.isalpha():
			if c.islower():
				res += chr((ord(c) - ord('a') + key) % 26 + ord('a'))
			else:
				res += chr((ord(c) - ord('A') + key) % 26 + ord('A'))
		else:
			res += c
	return res
n = input()
message = input()
key = int(input())
print(encode(message, key))


n = int(input())
string = input()
k = int(input())
new_string = ''
(upper_case_high, lower_case_high) = (ord('Z'), ord('z'))
(upper_case_low, lower_case_low) = (ord('A'), ord('a'))
for char in string:
	upper_case = False
	lower_case = False
	ascii_val = ord(char)
	if lower_case_low <= ascii_val <= lower_case_high:
		lower_case = True
	elif upper_case_low <= ascii_val <= upper_case_high:
		upper_case = True
	else:
		new_string += char
	if lower_case or upper_case:
		ascii_val += k
		if lower_case:
			while ascii_val > lower_case_high:
				ascii_val -= 26
		elif upper_case:
			while ascii_val > upper_case_high:
				ascii_val -= 26
		new_string += chr(ascii_val)
print(new_string)


import sys
n = int(input())
s = input()
k = int(input())
k = k % 26
for x in s:
	y = ord(x)
	if y >= 97 and y <= 122:
		y = y + k
		if y > 122:
			y = y - 122 + 97 - 1
	elif y >= 65 and y <= 90:
		y = y + k
		if y > 90:
			y = y - 90 + 65 - 1
	sys.stdout.write(chr(y))


import string
n = input()
s = input()
m = int(input())
r = ''
for c in s:
	if c in string.ascii_letters:
		if c.isupper():
			r += string.ascii_uppercase[(m + ord(c) - ord('A')) % 26]
		else:
			r += string.ascii_lowercase[(m + ord(c) - ord('a')) % 26]
	else:
		r += c
print(r)


import sys
lines = sys.stdin.read().split('\n')
line2 = lines[1]
incr = int(lines[2])
new_str = ''
for l in line2:
	if l.isalpha():
		to_incr = incr % 26
		if ord(l) <= 90 and to_incr > 90 - ord(l):
			remainder = to_incr - (90 - ord(l))
			new_str += str(chr(64 + remainder))
		elif to_incr > 122 - ord(l):
			remainder = to_incr - (122 - ord(l))
			new_str += str(chr(96 + remainder))
		else:
			new_str += str(chr(ord(l) + to_incr))
	else:
		new_str += l
print(new_str)


lowerAlphabetBound = ord('a')
upperAlphabetBound = ord('A')

def encodeString(input, rotation):
	output = ''
	for char in input:
		if not str.isalpha(char):
			output = output + char
		else:
			newChar = ord(char) + rotation
			checkBound = upperAlphabetBound if str.isupper(char) else lowerAlphabetBound
			while newChar > checkBound + 25:
				newChar = newChar - 26
			while newChar < checkBound:
				newChar = newChar + 26
			output = output + chr(newChar)
	return output
length = int(input())
string = input()
rotation = int(input())
print(encodeString(string, rotation))


import sys
alphabet = {}
size = input()
inString = list(input())
shift = int(input())
encrypt = ''
for ch in inString:
	ascii = ord(ch)
	if 65 <= ascii and ascii <= 90:
		pos = abs(ascii + shift - 65) % 26
		ascii = pos + 65
	elif 97 <= ascii and ascii <= 122:
		pos = abs(ascii + shift - 97) % 26
		ascii = pos + 97
	encrypt += str(chr(ascii))
print(encrypt)


strLength = int(input())
rawStr = input()
key = int(input())
encryptedText = ''
for x in range(0, strLength):
	asciiCode = ord(rawStr[x])
	encryptedAsciiCode = asciiCode
	if asciiCode > 64 and asciiCode < 91:
		encryptedAsciiCode = asciiCode + key % 26
		if encryptedAsciiCode > 90:
			encryptedAsciiCode = encryptedAsciiCode % 90 + 64
	if asciiCode > 96 and asciiCode < 123:
		encryptedAsciiCode = asciiCode + key % 26
		if encryptedAsciiCode > 122:
			encryptedAsciiCode = encryptedAsciiCode % 122 + 96
	encryptedLetter = chr(encryptedAsciiCode)
	encryptedText += str(encryptedLetter)
print(encryptedText)


def shift(char, ammount):
	if char in 'abcdefghijklmnopqrstuvwxyz':
		a = ord(char) - 97
		a += ammount
		a %= 26
		a += 97
		return chr(a)
	elif char in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
		a = ord(char) - 65
		a += ammount
		a %= 26
		a += 65
		return chr(a)
	else:
		return char
input()
word = input()
ammount = int(input())
retWord = ''
for char in word:
	retWord += shift(char, ammount)
print(retWord)


n = int(input())
string = input()
k = int(input())

def caesar(c):
	if c >= 65 and c <= 90:
		c += k
		if c > 90:
			c -= 26
	elif c >= 97 and c <= 122:
		c += k
		if c > 122:
			c -= 26
	return c
k = k % 26
ascii = [ord(c) for c in string]
ascii = [caesar(c) for c in ascii]
print(''.join([chr(c) for c in ascii]))


n = int(input())
s = input()
k = int(input())
k %= 26
ans = ''
for i in s:
	if 'a' <= i <= 'z':
		ass = ord(i)
		ass += k
		if ass > 122:
			ass -= 26
		ans += chr(ass)
	elif 'A' <= i <= 'Z':
		ass = ord(i)
		ass += k
		if ass > 90:
			ass -= 26
		ans += chr(ass)
	else:
		ans += i
print(ans)


input()
s = input()
k = int(input())
lalpha = 'abcdefghijklmnopqrstuvwxyz'
ualpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ns = ''
for e in s:
	if e in lalpha:
		e = lalpha[(lalpha.index(e) + k) % 26]
	elif e in ualpha:
		e = ualpha[(ualpha.index(e) + k) % 26]
	ns = ns + e
print(ns)


__author__ = 'Ashu'
import sys
n = int(sys.stdin.readline())
st = sys.stdin.readline()
k = int(sys.stdin.readline())
res = list(st)
k %= ord('z') - ord('a') + 1
for (j, i) in enumerate(res):
	if i.isalpha():
		if i.isupper():
			t = ord(i) + k
			if t > ord('Z'):
				t = t - ord('Z') + ord('A') - 1
			res[j] = chr(t)
		else:
			t = ord(i) + k
			if t > ord('z'):
				t = t - ord('z') + ord('a') - 1
			res[j] = chr(t)
print(''.join(res))


from string import ascii_lowercase as lettersLower
from string import ascii_uppercase as lettersUpper

def convert(letter, offset):
	if letter in lettersLower:
		searchStr = lettersLower
	elif letter in lettersUpper:
		searchStr = lettersUpper
	else:
		return letter
	return searchStr[(searchStr.index(letter) + offset) % 26]
num_letters = int(input())
letters = [_ for _ in input()]
offset = int(input())
result = map(lambda x: convert(x, offset), letters)
print(''.join(list(result)))


import string

def encrypt(s, k):
	res = string.ascii_lowercase[k:] + string.ascii_lowercase[:k]
	lm = {ord(s): r for (s, r) in zip(string.ascii_lowercase, res)}
	res = string.ascii_uppercase[k:] + string.ascii_uppercase[:k]
	um = {ord(s): r for (s, r) in zip(string.ascii_uppercase, res)}
	return s.translate(lm).translate(um)
_ = input()
s = input()
k = int(input())
print(encrypt(s, k % 26))


length = int(input())
string = list(input())
shift = int(input())
if shift > 0:
	shift = shift % 26
if shift < 0:
	shift = 26 - shift % 26
final = ''
for char in string:
	if 65 <= ord(char) <= 90:
		char = chr(ord(char) + shift)
		if ord(char) < 65:
			char = chr(ord(char) + 26)
		if ord(char) > 90:
			char = chr(ord(char) - 26)
	if 97 <= ord(char) <= 122:
		char = chr(ord(char) + shift)
		if ord(char) < 97:
			char = chr(ord(char) + 26)
		if ord(char) > 122:
			char = chr(ord(char) - 26)
	final += char
print(final)


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

def cypher(s, k):
	s2 = ''
	for c in s:
		start = -1
		end = -1
		rel = ord(c)
		if c >= 'a' and c <= 'z':
			start = ord('a')
			end = ord('z')
		if c >= 'A' and c <= 'Z':
			start = ord('A')
			end = ord('Z')
		if start != -1:
			rel = rel - start
			rel = rel + k
			rel = rel % (end + 1 - start)
			rel = rel + start
		s2 += chr(rel)
	return s2
print('%s' % cypher(s, k))


lowercase = 'abcdefghijklmnopqrstuvwxyz'
uppcase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
lowercase = list(lowercase)
uppcase = list(uppcase)
newPhrase = ''
length = int(input())
phrase = str(input())
offset = int(input())
while offset > 26:
	offset -= 26
for i in range(0, len(phrase)):
	for letter in range(0, len(lowercase)):
		if phrase[i] == lowercase[letter]:
			if letter < 26 - offset:
				newPhrase += lowercase[letter + offset]
			else:
				newPhrase += lowercase[letter - 26 + offset]
		elif phrase[i] == uppcase[letter]:
			if letter < 26 - offset:
				newPhrase += uppcase[letter + offset]
			else:
				newPhrase += uppcase[letter - 26 + offset]
	if phrase[i] not in lowercase and phrase[i] not in uppcase:
		newPhrase += phrase[i]
print(newPhrase)


N = int(input())
S = input()
K = int(input())
a = 'abcdefghijklmnopqrstuvwxyz'
A = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in S:
	if i in a:
		print(a[(a.index(i) + K) % 26], end='')
	elif i in A:
		print(A[(A.index(i) + K) % 26], end='')
	else:
		print(i, end='')


input()
s = input()
rot = int(input())
out = []
for c in s:
	n = ord(c)
	if 65 <= n <= 90:
		out.append(chr((n - 65 + rot) % 26 + 65))
	elif 97 <= n <= 122:
		out.append(chr((n - 97 + rot) % 26 + 97))
	else:
		out.append(c)
print(''.join(out))


N = int(input())
string = input().strip()
rot = int(input().strip())
smalls = 'abcdefghijklmnopqrstuvwxyz'
caps = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
answer = ''
for a in enumerate(string):
	if ord(a[1]) >= 65 and ord(a[1]) <= 90:
		caps_index = caps.index(a[1])
		answer += caps[(caps_index + rot) % 26]
	elif ord(a[1]) >= 97 and ord(a[1]) <= 122:
		smalls_index = smalls.index(a[1])
		answer += smalls[(smalls_index + rot) % 26]
	else:
		answer += a[1]
print(answer)


input()
s = input()
k = int(input())
upper_pos = {i for i in range(len(s)) if s[i].isupper()}
mapping = str.maketrans({i + 97: (i + k) % 26 + 97 for i in range(26)})
out = s.lower().translate(mapping)
print(''.join((out[i].upper() if i in upper_pos else out[i] for i in range(len(out)))))


def caesar_encode():
	length = int(input())
	string_o = str(input())
	string_f = []
	final_string = ''
	shift = int(input())
	if shift > 26:
		shift -= 26
		if shift > 26:
			shift -= 26
			if shift > 26:
				shift -= 26
	for i in range(0, length):
		if 65 <= ord(string_o[i]) <= 90:
			int_string_n = ord(string_o[i]) + shift
			if int_string_n > 90:
				int_string_n -= 26
				string_f.append(chr(int_string_n))
			else:
				string_f.append(chr(int_string_n))
		elif 97 <= ord(string_o[i]) <= 122:
			int_string_n = ord(string_o[i]) + shift
			if int_string_n > 122:
				int_string_n -= 26
				string_f.append(chr(int_string_n))
			else:
				string_f.append(chr(int_string_n))
		else:
			string_f.append(string_o[i])
	for i in string_f:
		final_string = final_string + i
	print(final_string)
caesar_encode()


alphabet = 'abcdefghijklmnopqrstuvwxyz'

def encrypt(s, shift):
	news = ''
	for i in s:
		if i.lower() in alphabet:
			if i.upper() == i:
				c = alphabet[(alphabet.index(i.lower()) + shift) % len(alphabet)]
				news = news + c.upper()
			else:
				c = alphabet[(alphabet.index(i) + shift) % len(alphabet)]
				news = news + c
		else:
			news = news + i
	print(news, end='')
a = input()
b = input()
c = int(input())
encrypt(b, c)


n = int(input())
s = list(input())
k = int(input()) % 26
s2 = []
for i in s:
	if i >= 'A' and i <= 'Z':
		charNum = ord('A') + (ord(i) - ord('A') + k) % 26
		s2.append(chr(charNum))
	elif i >= 'a' and i <= 'z':
		charNum = ord('a') + (ord(i) - ord('a') + k) % 26
		s2.append(chr(charNum))
	else:
		s2.append(i)
code = ''
for i in s2:
	code += i
print(code)


def roundadd(a, b, width):
	while a > width:
		a -= width
	if a + b >= width:
		return a + b - width
	else:
		return a + b

def encrypt(text, x):
	a = list((chr(i) for i in range(ord('a'), ord('z') + 1)))
	A = list((chr(i) for i in range(ord('A'), ord('Z') + 1)))
	r = ''
	for i in text:
		if i in a:
			r += a[roundadd(x, a.index(i), 26)]
		elif i in A:
			r += A[roundadd(x, A.index(i), 26)]
		else:
			r += i
	return r
length = int(input())
text = input()
enccode = int(input())
print(encrypt(text, enccode))


n = int(input())
string = input()
en = int(input())
encrypt = []
(i, j, ans) = (0, 0, 0)
for i in string:
	m = ord(i)
	if m >= 65 and m <= 90 or (m >= 97 and m <= 122):
		if m >= 97 and m <= 122:
			j = m + en
			if j >= 97 and j <= 122:
				k = chr(j)
				encrypt.append(k)
			else:
				while not (j >= 97 and j <= 122):
					j = j - 26
				k = chr(j)
				encrypt.append(k)
		elif m >= 65 and m <= 90:
			j = m + en
			if j >= 65 and j <= 90:
				k = chr(j)
				encrypt.append(k)
			else:
				while not (j >= 65 and j <= 90):
					j = j - 26
				k = chr(j)
				encrypt.append(k)
	else:
		k = i
		encrypt.append(k)
print(''.join(encrypt))


from string import ascii_lowercase, ascii_uppercase

def rot(c, k, charset):
	return charset[(charset.index(c) + k) % len(charset)]
n = int(input())
s = input()
k = int(input())
new_s = []
for c in s:
	if c in ascii_lowercase:
		new_c = rot(c, k, ascii_lowercase)
	elif c in ascii_uppercase:
		new_c = rot(c, k, ascii_uppercase)
	else:
		new_c = c
	new_s.append(new_c)
print(''.join(new_s))


from string import ascii_lowercase, ascii_uppercase
chars = ascii_lowercase * 5 + ascii_uppercase * 5
n = int(input())
s = input()
d = int(input())
res = ''
for i in range(n):
	c = s[i]
	if c in chars:
		c = chars[chars.index(c) + d]
	res += c
print(res)


(n, s, k) = (int(input()), input(), int(input()))
mods = ''
for char in s:
	if ord(char) in range(ord('a'), ord('z') + 1):
		new_ord = ord(char) + k % 26
		if new_ord in range(ord('a'), ord('z') + 1):
			mods += chr(new_ord)
		else:
			mods += chr(new_ord - 26)
	elif ord(char) in range(ord('A'), ord('Z') + 1):
		new_ord = ord(char) + k % 26
		if new_ord in range(ord('A'), ord('Z') + 1):
			mods += chr(new_ord)
		else:
			mods += chr(new_ord - 26)
	else:
		mods += char
print(mods)


def caesar(lens, txt, krot):
	ret = ''
	krot %= 26
	for i in range(lens):
		if txt[i].isalpha():
			uc = ord(txt[i])
			if uc > 96:
				uc = 97 + (uc - 97 + krot) % 26
			else:
				uc = 65 + (uc - 65 + krot) % 26
			ret += str(chr(uc))
		else:
			ret += txt[i]
	return ret
lens = int(input())
txt = input()
krot = int(input())
print(caesar(lens, txt, krot))


import string
l = int(input())
s = input()
k = int(input())
o = ''
lower = string.ascii_lowercase
upper = string.ascii_uppercase
for x in s:
	if x in lower:
		o = o + lower[(lower.index(x) + k) % len(lower)]
	elif x in upper:
		o = o + upper[(upper.index(x) + k) % len(upper)]
	else:
		o = o + x
print(o)


import string
input()
tex = input()
shift = int(input()) % 26
out = ''
letter_vals = [ord(i) for i in string.ascii_lowercase]
for i in tex:
	if i in string.ascii_letters:
		isUpperc = i.isupper()
		i = i.lower()
		temp = ord(i) + shift
		if not temp in letter_vals:
			temp -= 26
		temp = chr(temp)
		if isUpperc:
			temp = temp.upper()
		out += temp
	else:
		out += i
print(out)


n = int(input())
s = list(input())
l = ''
A = ord('A')
k = int(input())
a = ord('a')
for i in range(n):
	if A <= ord(s[i]) < A + 26:
		l += chr((ord(s[i]) - A + k) % 26 + A)
	elif a <= ord(s[i]) < a + 26:
		l += chr((ord(s[i]) - a + k) % 26 + a)
	else:
		l += s[i]
print(l)


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']
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']
n = int(input())
string = input()
k = int(input())
out = ''
for i in range(0, n):
	if string[i] in alpha:
		out = out + alpha[(alpha.index(string[i]) + k) % 26]
	elif string[i] in ALPHA:
		out = out + ALPHA[(ALPHA.index(string[i]) + k) % 26]
	else:
		out = out + string[i]
print(out)


length = int(input())
string = input()
k = int(input())
dict = {'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}
list2 = sorted(dict.keys())
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']
list3 = []
for element in string:
	if (element in list2) == True:
		new_letter_number = list2.index(element) + k
		while new_letter_number > 25:
			new_letter_number -= 26
		element = list2[new_letter_number]
	elif (element in list) == True:
		new_letter_number = list.index(element) + k
		while new_letter_number > 25:
			new_letter_number -= 26
		element = list[new_letter_number]
	list3.append(element)
string2 = ''
for i in list3:
	string2 = string2 + i
print(string2)


def caesar_cipher(S, K):
	E = []
	for s in S:
		c = ord(s)
		if 65 <= c <= 90:
			E.append(chr(65 + (c - 65 + K) % 26))
		elif 97 <= c <= 122:
			E.append(chr(97 + (c - 97 + K) % 26))
		else:
			E.append(s)
	return ''.join(E)

def main():
	N = int(input())
	S = input()
	K = int(input())
	print(caesar_cipher(S, K))
main()


n = int(input())
string = input()
k = int(input())

def rotateChar(c, k, base):
	return (c - base + k) % 26 + base
ans = []
for i in range(n):
	c = ord(string[i])
	if c >= ord('a') and c <= ord('z'):
		c = rotateChar(c, k, ord('a'))
	elif c >= ord('A') and c <= ord('Z'):
		c = rotateChar(c, k, ord('A'))
	ans.append(chr(c))
print(''.join(ans))


N = int(input())
S = input()
K = int(input())
code = ''
for l in S:
	if ord(l) >= 97 and ord(l) <= 122:
		char = chr((ord(l) + K - 97) % 26 + 97)
	elif ord(l) >= 65 and ord(l) <= 90:
		char = chr((ord(l) + K - 65) % 26 + 65)
	else:
		char = l
	code += char
print(code)


import codecs
(_, text, rot) = (input(), input(), int(input()) % 26)
if rot == 13:
	print(codecs.decode(text, 'rot13'))
else:
	(c1, c2) = (list(range(65, 91)), list(range(97, 123)))
	cipher = dict(zip(c1 + c2, c1[rot:] + c1[:rot] + c2[rot:] + c2[:rot]))
	print(text.translate(cipher))


lth = int(input())
str = input()
k = int(input())
encrypted = []
for c in str:
	asc = ord(c)
	if 65 <= asc <= 90:
		asc = asc + k
		while asc > 90:
			asc = asc % 90 + 64
	elif 97 <= asc <= 122:
		asc = asc + k
		while asc > 122:
			asc = asc % 122 + 96
	encrypted.append(chr(asc))
print(''.join(encrypted))


from string import ascii_lowercase, ascii_uppercase
input()
s = input()
k = int(input())
enc = []
for c in s:
	if c in ascii_lowercase:
		enc.append(ascii_lowercase[(ascii_lowercase.index(c) + k) % 26])
	elif c in ascii_uppercase:
		enc.append(ascii_uppercase[(ascii_uppercase.index(c) + k) % 26])
	else:
		enc.append(c)
print(''.join(enc))


n = int(input())
s = input()
st = ''
k = int(input())
k = k % 26
for i in s:
	if ord(i) <= 90 - k and ord(i) >= 65 or (ord(i) <= 122 - k and ord(i) >= 97):
		st += chr(ord(i) + k)
	elif ord(i) <= 90 and ord(i) > 90 - k or (ord(i) <= 122 and ord(i) > 122 - k):
		st += chr(ord(i) + k - 26)
	else:
		st += i
print(st)


minUpper = 65
maxUpper = 90
minLower = 97
maxLower = 122
N = int(input())
S = input()
K = int(input())
charArray = []
message = []
for i in range(N):
	if ord(S[i]) >= minUpper and ord(S[i]) <= maxUpper:
		minValue = minUpper
	elif ord(S[i]) >= minLower and ord(S[i]) <= maxLower:
		minValue = minLower
	else:
		message.append(S[i])
		continue
	messageItemIdx = ord(S[i]) - minValue
	messageItemIdx2 = (messageItemIdx + K) % 26
	messageItem = chr(messageItemIdx2 + minValue)
	message.append(messageItem)
print(''.join(message))