AtCoder Beginner Contest 126 - Changing a Character

You are given a string S of length N consisting of A, B and C, and an integer K which is between 1 and N (inclusive).
Print the string S after lowercasing the K-th character in it.

-----Constraints-----
 - 1 ≤ N ≤ 50
 - 1 ≤ K ≤ N
 - S is a string of length N consisting of A, B and C.

-----Input-----
Input is given from Standard Input in the following format:
N K
S

-----Output-----
Print the string S after lowercasing the K-th character in it.

-----Sample Input-----
3 1
ABC

-----Sample Output-----
aBC

Difficulty: EASY

Starter code:

Solutions:
(N, K) = map(int, input().split())
s = input()
s = s[:K - 1] + s[K - 1].lower() + s[K:]
print(s)


(a, n) = map(int, input().split())
s = input()
print(s[:n - 1] + s[n - 1].lower() + s[n:])


(a, b) = map(int, input().split())
s = list(input())
s[b - 1] = s[b - 1].lower()
print(''.join(s))


(n, k) = map(int, input().split())
s = input()
ans = s[k - 1].lower()
print(s[:k - 1] + ans + s[k:])


(a, b) = map(int, input().split())
S = input()
Sa = S[:b - 1] + S[b - 1].lower() + S[b:]
print(Sa)


(N, K) = map(int, input().split())
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K:N])


(a, b) = map(int, input().split())
s = input()
print(s[:b - 1] + s[b - 1:b].lower() + s[b:a])


(N, K) = map(int, input().split())
S = input()
T = S[:K - 1]
a = S[K - 1].lower()
U = S[K:]
print(T + a + U)


(n, k) = map(int, input().split())
s = input()
s2 = chr(ord(s[k - 1]) + 32)
print(s[:k - 1] + s2 + s[k:])


(n, k) = map(int, input().split())
s = input()
print(f'{s[:k - 1]}{s[k - 1].lower()}{s[k:]}')


(N, K) = map(int, input().split())
S = input()
print(S[:K - 1] + chr(ord(S[K - 1]) + 32) + S[K:])


(n, k) = map(int, input().split())
s = list(input())
for i in range(1, n + 1):
	if i == k:
		print(s[i - 1].lower(), end='')
		continue
	print(s[i - 1], end='')


(N, K) = map(int, input().split())
S = input()
s = list(S)
s[K - 1] = s[K - 1].lower()
print(''.join(s))


def mapt(fn, *args):
	return tuple(map(fn, *args))

def Input():
	return mapt(int, input().split(' '))

def main():
	(n, k) = Input()
	s = input()
	print(''.join((ch.lower() if index == k else ch for (index, ch) in enumerate(s, 1))))
main()


(N, K) = [int(n) for n in input().split()]
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K:])


(n, k) = map(int, input().split())
s = str(input())
ans = ''
if s[k - 1] == 'A':
	ans = s[:k - 1] + 'a' + s[k:]
	print(ans)
	return
elif s[k - 1] == 'B':
	ans = s[:k - 1] + 'b' + s[k:]
	print(ans)
	return
elif s[k - 1] == 'C':
	ans = s[:k - 1] + 'c' + s[k:]
	print(ans)
	return


(n, k) = [int(i) for i in input().split()]
s = input()
print(s[0:k - 1] + s[k - 1].lower() + s[k:])


(a, b) = map(int, input().split())
l = list(input())
l[b - 1] = l[b - 1].lower()
print(''.join(l))


(N, K) = map(int, input().split())
S = input()
s = S[:K - 1]
s += S[K - 1].swapcase()
s += S[K:]
print(s)


(n, k) = list(map(int, input().split()))
s = input()
print(s[:k - 1] + s[k - 1].lower() + s[k:])


(N, K) = [int(x) for x in input().split()]
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K:])


(n, k) = map(int, input().split())
l = list(input())
l[k - 1] = l[k - 1].lower()
print(''.join(l))


(n, k) = map(int, input().split())
s = input()
a = s[:k - 1]
b = s[k - 1]
c = s[k:]
print(a + b.lower() + c)


(_, k) = map(int, input().split())
s = input()
print(s[:k - 1] + s[k - 1].lower() + s[k:])


k = int(input().split()[1]) - 1
s = input()
print(s[:k], s[k].lower(), s[k + 1:], sep='')


(n, k) = map(int, input().split())
S = input()
ans = S[:k - 1] + S[k - 1].lower() + S[k:]
print(ans)


(a, b) = map(int, input().split())
c = input()
print(c[:b - 1] + c[b - 1].lower() + c[b:])


(n, k) = map(int, input().split())
s = input()
u = s.lower()
print(s[:k - 1] + u[k - 1:k] + s[k:])


(n, k) = map(int, input().split())
s = input()
ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
abc = 'abcdefghijklmnopqrstuvwxyz'
print(s[:k - 1] + abc[ABC.index(s[k - 1])] + s[k:])


(N, K) = map(int, input().split())
K -= 1
S = list(input())
for (i, c) in enumerate(S):
	if i == K:
		c = c.lower()
	print(c, end='')
print('')


(n, k) = map(int, input().split())
s = input()
S = s[0:k - 1] + s[k - 1].lower() + s[k:]
print(S)


(N, K) = map(int, input().split())
st = input()
print(st[:K - 1] + st[K - 1].lower() + st[K:])


(N, k) = map(int, input().split())
S = input()
print(S[:k - 1] + S[k - 1].lower() + S[k:])


(n, k) = map(int, input().split())
s = input()
sl = []
for i in range(n):
	if i + 1 == k:
		sl.append(s[i].lower())
	else:
		sl.append(s[i])
print(''.join(sl))


(n, m) = map(int, input().split())
s = input()
print(s[:m - 1] + s[m - 1].lower() + s[m:])


(N, K) = map(int, input().split())
S = input()
print(S[0:K - 1] + str.lower(S[K - 1]) + S[K:N])


(n, k) = list(map(int, input().split()))
s = list(input())
s[k - 1] = chr(ord(s[k - 1]) + ord('a') - ord('A'))
print(''.join(s))


(N, K) = input().split()
K = int(K)
S = input()
print(S[0:K - 1] + S[K - 1].lower() + S[K:])


(N, M) = [int(i) for i in input().split()]
S = input()
print(S[:M - 1] + S[M - 1].lower() + S[M:])


(n, k) = map(int, input().split())
ls = list(input())
ls[k - 1] = ls[k - 1].lower()
print(''.join(ls))


(N, K) = map(int, input().split())
S = input()
if S[K - 1] == 'A':
	rep = 'a'
elif S[K - 1] == 'B':
	rep = 'b'
else:
	rep = 'c'
print(S[:K - 1] + rep + S[K:])


(n, k) = map(int, input().split())
s = input()
t = s.lower()
print(s[:k - 1] + t[k - 1] + s[k:])


(n, k) = map(int, input().split())
s = str(input())
b = s[k - 1].lower()
print(s[:k - 1] + b + s[k:])


import io
(n, k) = map(int, input().split())
a = input()
a = a[:k - 1] + a[k - 1].lower() + a[k:]
print(a)


(n, k) = map(int, input().split())
s = list(input())
ss = s[k - 1]
p = ss.lower()
s[k - 1] = p
ans = ''.join(s)
print(ans)


(n, k) = list(map(int, input().split()))
S = list(input())
x = S.pop(k - 1).lower()
S.insert(k - 1, x)
print(''.join(S))


(N, K) = map(int, input().split())
S = list(input())
S[K - 1] = S[K - 1].lower()
ans = ''
for i in S:
	ans += i
print(ans)


s = input().split()
t = input()
k = int(s[1]) - 1
print(t[:k] + t[k].lower() + t[k + 1:])


(N, K) = map(int, input().split())
S = str(input())
A = ''
for i in range(N):
	if i + 1 == K:
		A += S[i].lower()
	else:
		A += S[i]
print(A)


(N, K) = map(int, input().split())
S = input()
print(S[:K - 1] + 'abc'[ord(S[K - 1]) - ord('A')] + S[K:])


(N, K) = map(int, input().split())
S = input()
lsS = list(S)
lsS[K - 1] = lsS[K - 1].lower()
ans = ''.join(lsS)
print(ans)


(n, k) = map(int, input().split())
s = input()
h = s[k - 1].lower()
print(s[:k - 1] + h + s[k:])


(n, k) = list(map(int, input().split()))
s = input()
ans = s[:k - 1] + s[k - 1].swapcase() + s[k:]
print(ans)


(n, k) = map(int, input().split())
S = input()
s = str.lower(S[k - 1])
ans = S[:k - 1] + s + S[k:]
print(ans)


(N, K) = (int(i) for i in input().split())
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K:])


(N, K) = input().split()
N = int(N)
K = int(K)
S = input()
SU = S.lower()
print(S[:K - 1] + SU[K - 1] + S[K:])


(n, k) = map(int, input().split())
s = list(input())
if s[k - 1] == 'A':
	s[k - 1] = 'a'
elif s[k - 1] == 'B':
	s[k - 1] = 'b'
elif s[k - 1] == 'C':
	s[k - 1] = 'c'
ans = ''.join(s)
print(ans)


(n, k) = map(int, input().split())
msg = input()
s = msg[:k - 1] + msg[k - 1].lower() + msg[k:]
print(s)


(N, K) = list(map(int, input().split()))
S = input().strip()
c = S[K - 1].lower()
print(S[:K - 1] + c + S[K:])


(n, k) = map(int, input().split())
s = list(input())
s[k - 1] = str.lower(s[k - 1])
print(''.join(s))


(n, k) = map(int, input().split())
s = input()
a = s[k - 1].lower()
print(s[0:k - 1] + a + s[k:])


(n, k) = map(int, input().split())
s = input()
s = s[k - 1:] + s[:k - 1]
ans = s.capitalize().swapcase()
print(ans[n - k + 1:] + ans[:n - k + 1])


(N, K) = list(map(int, input().split()))
S = input()
print(S[0:K - 1] + S[K - 1].lower() + S[K:N])


(A, B) = map(int, input().split())
C = input()
print(C[:B - 1] + C[B - 1].lower() + C[B:])


(n, k) = map(int, input().split())
s = input()
l = s[k - 1].lower()
print(s[:k - 1] + l + s[k:])


k = int(input().split()[1])
s = input()
print(s[0:k - 1] + s[k - 1:k].lower() + s[k:len(s) + 1])


(n, k) = map(int, input().split())
s = str(input())
print(s[0:k - 1] + str.lower(s[k - 1]) + s[k:])


(x, y) = map(int, input().split())
s = list(input())
s[y - 1] = s[y - 1].lower()
print(''.join(s))


(n, k) = map(int, input().split())
x = input()
print(x[:k - 1] + x[k - 1].lower() + x[k:])


(N, K) = list(map(int, input().split()))
S = input()
capital = ['A', 'B', 'C']
small = ['a', 'b', 'c']
i = capital.index(S[K - 1])
ans = S[:K - 1] + small[i] + S[K:]
print(ans)


(k, s) = open(0)
k = int(k[2:])
print(s[:k - 1] + s[k - 1].lower() + s[k:])


(_, K) = map(int, input().split())
S = input()
K = K - 1
print(S[:K] + S[K].lower() + S[K + 1:])


(N, K) = input().strip().split()
S = input()
N = int(N)
K = int(K)
S = list(S)
if S[K - 1] == 'A':
	S[K - 1] = 'a'
elif S[K - 1] == 'B':
	S[K - 1] = 'b'
else:
	S[K - 1] = 'c'
print(''.join(S))


(N, K) = map(int, input().split())
s = list(input())
s[K - 1] = chr(ord(s[K - 1]) + 32)
print(''.join(s))


(n, k) = map(int, input().split())
s = input()
print(s[:k - 1], end='')
print(str.swapcase(s[k - 1]), end='')
print(s[k:])


(a, b) = map(int, input().split())
c = input()
print(c[0:b - 1] + c[b - 1].swapcase() + c[b:a])


(n, k) = map(int, input().split())
a = list(input())
a[k - 1] = chr(ord(a[k - 1]) + 32)
print(''.join(a))


(n, k) = map(int, input().split())
s = list(input())
s[k - 1] = s[k - 1].swapcase()
print(''.join(s))


(n, k) = map(int, input().split())
a = list(input())
a[k - 1] = a[k - 1].lower()
print(''.join(a))


(N, K) = list(map(int, input().split()))
S = input()
print(S[:K - 1] + S[K - 1:K].swapcase() + S[K:])


(n, k) = map(int, input().split())
s = input()
ret = s.lower()
print(s[:k - 1] + ret[k - 1] + s[k:])


(n, k) = map(int, input().split())
X = input()
print(X[:k - 1] + X[k - 1].lower() + X[k:])


def str_replace_to_lower() -> str:
	(len_str, target_index) = map(int, input().split())
	word = input()
	list_of_word = list(word)
	list_of_word[target_index - 1] = list_of_word[target_index - 1].lower()
	return ''.join(list_of_word)
print(str_replace_to_lower())


(x, y) = map(int, input().split())
s = input()
print(s[:y - 1] + s[y - 1].lower() + s[y:])


(N, K) = map(int, input().split())
moji = str(input())
ans = moji[:K - 1] + moji[K - 1].lower() + moji[K:]
print(ans)


(A, B) = map(int, input().split())
S = input()
print(S[:B - 1] + S[B - 1].lower() + S[B:])


(n, k) = map(int, input().split())
s = list(input())
s[k - 1] = s[k - 1].lower()
for i in s:
	print(i, end='')
print()


num = input().split()
N = int(num[0])
K = int(num[1])
S = input()
S2 = S[K - 1]
S = S[:K - 1] + S2.lower() + S[K:]
print(S)


(n, k) = list(map(int, input().split(' ')))
s = input()
m = ''
if s[k - 1].isupper():
	m = s[k - 1].lower()
else:
	m = s[k - 1].upper()
print(s[:k - 1] + m + s[k:])


(n, k) = map(int, input().split())
s = list(input())
if s[k - 1] == 'A':
	s[k - 1] = 'a'
elif s[k - 1] == 'B':
	s[k - 1] = 'b'
else:
	s[k - 1] = 'c'
a = ''
for i in range(n):
	a += s[i]
print(a)


(a, b) = input().split()
a = int(a)
b = int(b)
c = input()
(h, i, j) = (c[:b - 1], c[b - 1], c[b:])
if i == 'A':
	i = 'a'
if i == 'B':
	i = 'b'
if i == 'C':
	i = 'c'
print(h + i + j)


(N, K) = map(int, input().split())
S = list(input())
for i in range(N):
	if i == K - 1:
		S[i] = chr(ord(S[i]) + 32)
print(''.join(S))


(n, k) = map(int, input().split())
a = input()
print(a[:k - 1] + a[k - 1].lower() + a[k:])


(_, k) = input().split()
s = list(input())
k = int(k) - 1
s[k] = s[k].lower()
print(*s, sep='')


(_, K) = [int(i) for i in input().split()]
S = input()
print(S[:K - 1] + S[K - 1].lower() + S[K:])


(n, k) = map(int, input().split())
S = str(input())
print(S[:k - 1] + S[k - 1].lower() + S[k:])


(n, k) = map(int, input().split())
s = input()
ss = s[k - 1]
print(s[:k - 1] + ss.lower() + s[k:])


(n, k) = [int(x) for x in input().split()]
s = input()
k -= 1
s = list(s)
if s[k] == 'A':
	s[k] = 'a'
elif s[k] == 'B':
	s[k] = 'b'
elif s[k] == 'C':
	s[k] = 'c'
print(''.join(s))


(n, k) = map(int, input().split())

def replace(m):
	if m == 'A':
		return 'a'
	elif m == 'B':
		return 'b'
	else:
		return 'c'
abc_str = list(input())
abc_str[k - 1] = replace(abc_str[k - 1])
abc_str = ''.join(abc_str)
print(abc_str)


(a, b) = map(int, input().split())
c = list(input())
c[b - 1] = c[b - 1].lower()
print(*c, sep='')


(n, k) = map(int, input().split())
s = input()
ss = ''
for i in range(n):
	if i == k - 1:
		ss += s[i].lower()
	else:
		ss += s[i]
print(ss)


(N, K) = map(int, input().split())
S = str(input())
L = []
for i in range(N):
	L.append(S[i])
	if i == K - 1:
		L[i] = S[i].lower()
print(''.join(map(str, L)))


(n, k) = list(map(int, input().split()))
s = list(input())
t = ''
for (j, i) in enumerate(s):
	if j == k - 1:
		t += i.lower()
	else:
		t += i
print(t)


(a, b) = map(int, input().split())
n = input()
n = n[:b - 1] + n[b - 1].lower() + n[b:]
print(n)


(_, K) = map(int, input().split())
S = input()
print(S[0:K - 1], S[K - 1].lower(), S[K:], sep='')


(a, b) = map(int, input().split())
t = input()
print(t[:b - 1] + t[b - 1].lower() + t[b:])


(n, k) = list(map(int, input().split()))
s = input()
L = []
for i in range(n):
	L.append(s[i])
L[k - 1] = str.lower(L[k - 1])
ans = str()
for i in range(n):
	ans += L[i]
print(ans)


(n, k) = list(map(int, input().split()))
s = list(input())
tmp = s.pop(k - 1)
l = tmp.lower()
s.insert(k - 1, l)
print(''.join(s))


(n, k) = input().split()
n = int(k) - 1
s = input()
print(s[0:n] + s[n].lower() + s[n + 1:])


(n, k) = map(int, input().split())
s = input()
for i in range(len(s)):
	if i == k - 1:
		print(str.lower(s[i]), end='')
	else:
		print(s[i], end='')
print()


(n, k) = map(int, input().split())
S = list(input())
S[k - 1] = S[k - 1].lower()
print(*S, sep='')


(N, K) = map(int, input().split())
S = str(input())
T = list(map(str, S))
for i in range(N):
	if i == K - 1:
		T[i] = str.lower(T[i])
print(''.join(T))


Omoji = ['A', 'B', 'C']
Kmoji = ['a', 'b', 'c']
(n, k) = map(int, input().split())
s = str(input())
ans = ''
for i in range(n):
	if i == k - 1:
		for j in range(len(Omoji)):
			if s[i] == Omoji[j]:
				ans += Kmoji[j]
	else:
		ans += s[i]
print(ans)


(b, c) = map(int, input().split())
s = input()
print(s[0:c - 1] + s[c - 1].lower() + s[c:b])


(n, k) = map(int, input().split())
s = input()
c = 'a' if s[k - 1] == 'A' else 'b' if s[k - 1] == 'B' else 'c'
print(s[:k - 1] + c + s[k:])


(n, k) = map(int, input().split())
s = list(input())
s[k - 1] = chr(ord(s[k - 1]) + 32)
print(*s, sep='')


(n, k) = [int(x) for x in input().split()]
s = input()
print(s[:k - 1] + s[k - 1].lower() + s[k:])


(x, y) = [int(x) for x in input().split()]
z = input()
print(z[:y - 1] + z[y - 1].lower() + z[y:])


(n, k) = map(int, input().split())
s = input()
result_s = ''
a = 0
for s in list(s):
	a += 1
	if a == k:
		s = s.lower()
	result_s += s
print(result_s)


(a, b) = map(int, input().split())
c = list(input())
c[b - 1] = c[b - 1].lower()
print(''.join(c))


(N, K) = map(int, input().split())
S = input()
ans = ''
for i in range(N):
	if i != K - 1:
		ans += S[i]
	else:
		ans += S[i].lower()
print(ans)


(n, k) = map(int, input().split())
c = input()
print(c[:k - 1] + c[k - 1].lower() + c[k:])


(_, k) = map(int, input().split())
s = list(input())
s[k - 1] = s[k - 1].lower()
print(''.join(s))


(N, K) = map(int, input().split())
S = list(input())
if S[K - 1] == 'A':
	S[K - 1] = 'a'
if S[K - 1] == 'B':
	S[K - 1] = 'b'
if S[K - 1] == 'C':
	S[K - 1] = 'c'
for i in S:
	print(i, end='')


(N, b) = map(int, input().split())
S = input()
S = S[:b - 1] + S[b - 1].lower() + S[b:]
print(S)


(N, K) = map(int, input().split())
S = input()
print(''.join((c.lower() if i == K else c for (i, c) in enumerate(S, 1))))


(n, k) = map(int, input().split())
s = input()
print(s[:k - 1] + s[k - 1].swapcase() + s[k:])


(N, K) = map(int, input().split())
S = input()
ans = ''
for i in range(N):
	if i == K - 1:
		if S[i] == 'A':
			ans += 'a'
		elif S[i] == 'B':
			ans += 'b'
		else:
			ans += 'c'
	else:
		ans += S[i]
print(ans)


(n, k) = map(int, input().split())
s = input()
s0 = s[k - 1].lower()
print(s[:k - 1] + s0 + s[k:])


(N, K) = map(int, input().split())
S = input()
S2 = S.lower()
S3 = S[:K - 1] + S2[K - 1:K] + S[K:]
print(S3)


(N, K) = list(map(int, input().split()))
S = list(input())
if S[K - 1] == 'A':
	S[K - 1] = 'a'
elif S[K - 1] == 'B':
	S[K - 1] = 'b'
elif S[K - 1] == 'C':
	S[K - 1] = 'c'
''.join(S)
S_1 = S[0]
for i in range(1, N):
	S_1 = S_1 + S[i]
print(S_1)


(N, K) = map(int, input().split())
S = input()
ans = []
for i in range(N):
	if i == K - 1:
		x = ord(S[i])
		x += 32
		y = chr(x)
		ans.append(y)
	else:
		ans.append(S[i])
print(''.join(ans))


(n, k) = map(int, input().split())
p = input()
print(p[:k - 1] + p[k - 1].lower() + p[k:])


(n, k) = map(int, input().split())
b = list(input())
b[k - 1] = b[k - 1].lower()
print(*b, sep='')


(n, m) = map(int, input().split())
s = list(input())
s[m - 1] = s[m - 1].lower()
print(''.join(s))