Problem:


Score : 200 points

Problem Statement

You are given a string S of length N consisting of lowercase English letters, and an integer K.
Print the string obtained by replacing every character in S that differs from the K-th character of S, with *.

Constraints

1 \leq K \leq N\leq 10

S is a string of length N consisting of lowercase English letters.

N and K are integers.

Input

Input is given from Standard Input in the following format:

N
S
K

Output

Print the string obtained by replacing every character in S that differs from the K-th character of S, with *.

Sample Input 1

5
error
2

Sample Output 1

*rr*r

The second character of S is r. When we replace every character in error that differs from r with *, we get the string *rr*r.

Sample Input 2

6
eleven
5

Sample Output 2

e*e*e*

Sample Input 3

9
education
7

Sample Output 3

******i**



Sample input:
5
error
2


Sample output:
*rr*r

Submission status: Wrong Answer

Solution code:
N = int(input())
s = input()
S = [str(c) for c in s]
K = int(input())

for i in range(N):
    if str(S[i]) != str(S[K-1]):
        S[i] = "*"

Submission status: Wrong Answer

Solution code:
a=int(input())
b=input()
c=int(input())
word=b[c-1]
d=[]
for i in range(a):
    if b[i]!=word:
        d.append("*")
    else:
        d.append(b[i])
print(*d)

Submission status: Wrong Answer

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

t = S[K - 1]

print(t)

ans = ''
for i in S:
    if i == t:
        ans += i
    else:
        ans += '*'

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

N=int(input())
S=input()
K=int(input())-1
for s in S:
  if s != S[K]:
    print("*",end='')
  else:
    print(s,end='')
print()

Submission status: Wrong Answer

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

tmp = str(S[K-1])
l = []
for n,i in enumerate(S):
    print(i,tmp)
    if i==tmp:
        l.append(i)
    else:
        l.append('*')
print("".join(l))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = str(input())
k = int(input())
x = s[k-1]
ans = ""
print(x)
for i in range(n):
    if s[i] != x:
        ans += "*"
    if s[i] == x:
        ans += s[i]
print(ans)

Submission status: Wrong Answer

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

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

result = ''
sk = S[K-1]
print(sk)
for s in S:
	if sk == s:
		result += s
	else:
		result += '*'

print(result)

Submission status: Accepted

Solution code:
import sys


# \n
def input():
    return sys.stdin.readline().rstrip()

def main():

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

    d = S[K-1]

    for i in range(N):
        if S[i] !=d:
            S[i] ="*"

    print(*S,sep="")



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
k=int(input())
for i in range(n):
    if s[i]!=s[k-1]:
        s[i]="*"
print("".join(s))

Submission status: Accepted

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

c=s[k-1]

ans=""
for i in s:
  if i!=c:
    ans+="*"
  else:
    ans+=i
print(ans)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    n=I()
    s=SI()
    k=I()
    u=s[k-1]
    for i in range(n):
        if s[i]==u:
            print(s[i],end="")
        else:
            print("*",end="")
    








if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
ans = ""
for i in s:
  if s[k-1] == i:
    ans += i
  else:
    ans += "*"
print(ans)

Submission status: Accepted

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

x = s[k-1]
ans = ''
for i in range(len(s)):
    if s[i] == x:
        ans += s[i]
    else:
        ans += '*'

print (ans)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
K = int(input())
for i in range(N):
  if S[i] != S[K - 1]:
    print('*', end = '')
  else:
    print(S[i], end ='')

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
k = int(input())
for i in range(n):
    if s[i] != s[k-1]:
        s[i] = '*'
print(''.join(s))

Submission status: Accepted

Solution code:
n = int(input())
S = input()
k = int(input())
# print(S[k-1])
for s in S:
    if s != S[k-1]:
        print('*', end = '')
    else:
        print(s, end = '')

Submission status: Accepted

Solution code:
import math
from datetime import date

def main():

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

	ans = ""
	for c in s:
		if c == s[k]:
			ans += s[k]
		else:
			ans += "*"

	print(ans)

main()

Submission status: Accepted

Solution code:
N = int(input())
S = input()
K = int(input())
s = S[K-1]
for i in range(N):
  if S[i] == s:
    print(s, end="")
  else:
    print("*", end="")
print("")

Submission status: Accepted

Solution code:
N,S,K = (input() for T in range(0,3))
N,K = int(N),int(K)
D = ['*']*N
for TN in range(0,N):
    if S[TN]==S[K-1]:
        D[TN] = S[K-1]
print(''.join(D))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
for i in range(n):
    if s[i] != s[k-1]:
        print("*", end="")
    else:
        print(s[i], end="")

Submission status: Accepted

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

def main():
    n = int(input())
    S = input()
    k = int(input())
    print(*[s if s == S[k - 1] else "*" for s in S], sep="")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import re
n=input()
s=input()
k=int(input())
print(re.sub("A",s[k-1],re.sub("[a-z]","*",re.sub(s[k-1],"A",s))))

Submission status: Accepted

Solution code:
import re
n = int(input())
s = input()
k = int(input())
print(re.sub("A",s[k-1],re.sub("[a-z]","*",re.sub(s[k-1],"A",s))))

Submission status: Accepted

Solution code:
a = int(input())
b = input()
c = int(input())
for i in range(a):
  if b[i] == b[c-1]:
    print(b[i], end="")
  else:
    print("*", end="")

Submission status: Accepted

Solution code:
a = int(input())
b = list(input())
c = int(input()) - 1
ch = b[c]
for i in range(len(b)):
	if(b[i] != ch):
		b[i] = "*"
print(''.join(b))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
s = list(s)
k = int(input())
word = s[k-1]
for i in range(n):
    if s[i] != word:
        s[i] = "*"
print("".join(s))

Submission status: Accepted

Solution code:
#Tenka1 Programmer Beginner Contest 2019 B
n = int(input())
s = input()
k = int(input())
tr = s[k-1]
for i in s:
    print(i if i==tr else "*",end="")

Submission status: Accepted

Solution code:
n = int(input())
S = input()
k = S[int(input())-1]
print(*[s if s==k else '*' for s in S], sep='')

Submission status: Accepted

Solution code:
n=int(input())
s=input()
k=int(input())
ans=[]
for i in range(n):
    if s[i]==s[k-1]:
        t=s[i]
    else:
        t="*"
    ans.append(t)
print(*ans,sep="")

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
k = int(input())
word = ""
w = s[k-1]
for i in s:
    if w != i:
        word += "*"
    else:
        word += w
print(word)

Submission status: Accepted

Solution code:
b = int(input())
a = list(input())
n = int(input())

control = a[n - 1]

for i in range(0, b):
    if a[i] != control:
        a[i] = "*"
    print(a[i], end = "")

Submission status: Accepted

Solution code:
from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
s = input()
k = ii()

for i in range(n):
    if s[i] == s[k-1]:
        print(s[i],end="")
    else:
        print("*",end="")

Submission status: Accepted

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

for i in range(N):
  if S[i] == S[K-1]:
    continue
  else:
    S[i] = '*'
    
print(''.join(S))

Submission status: Accepted

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

s = S[K-1]
for i in range(N):
  if S[i] != s:
    S[i] = '*'
    
print(''.join(S))

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    S = input()
    K = int(readline())

    letter = S[K - 1]

    res = ""
    for x in S:
        if x == letter:
            res += letter
        else:
            res += "*"

    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# Tenka1 Programming Beginner Contest 2019: B – *e**** ********e* *e****e* ****e**
N = int(input())
S = input()
K = int(input())

s_k = S[K - 1]

replaced = ''
for s in S:
    replaced = replaced + '*' if s != s_k else replaced + s_k

print(replaced)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    s = input()
    k = int(input())
    ans = ""
    sk = s[k - 1]

    for ch in s:
        if ch == sk:
            ans += sk
        else:
            ans += "*"

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for s in S:
    print(s if s == S[k-1] else '*', end="")

Submission status: Accepted

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

c = s[k - 1]
ans = ''
for l in s:
    if l != c:
        ans += '*'
    else:
        ans += c
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
a = s[k-1]
l = []
for i in range(n):
  if s[i]!=a:
    l.append("*")
  else:
    l.append(a)
print(*l,sep='')

Submission status: Accepted

Solution code:
N = int(input())
S = input()
K = int(input())
X = S[K-1]
SS = list(S)
for i in range(len(SS)):
  if SS[i] != X:
    SS[i] = '*'
a = ''.join(SS)
print(a)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
K = int(input())
for i in range(N):
  if S[i] != S[K-1]:
    S[i] = "*"

print("".join(S))

Submission status: Accepted

Solution code:
input()
s = input()
k = int(input())
k-=1
p = s[k]
r = ''
for i in s:
	if i!=p:
		r+='*'
	else:
		r+=p
print(r)

Submission status: Accepted

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

x=s[k-1]
ans=[]
for i in range(n):
    if s[i]!=x:
        ans.append('*')
    else:
        ans.append(x)

print(''.join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
k = int(input())
for i in range(n):
    if s[i] == s[k-1]:
        print(s[i],end="")
    else:
        print("*",end="")

Submission status: Accepted

Solution code:
N = int(input())
S = input()
K = int(input())
s = S[K-1]
ans = ""
for ss in S:
  if ss == s:
    ans += s
  else:
    ans += "*"
print(ans)

Submission status: Accepted

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

a = s[k-1]
for i in range(n):
    if s[i] != a:
        s[i] = "*"
print("".join(s))

Submission status: Accepted

Solution code:
n=int(input())
l=list(input())
k=int(input())
s=l[k-1]
for i in range(n):
    if(l[i]!=s):
        l[i]='*'
print(''.join(l))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
L = []
for i in range(n):
    if s[i] != s[k-1]:
        L.append("*")
    else:
        L.append(s[i])
        
print("".join(L))

Submission status: Accepted

Solution code:
N = int(input())
S = input().rstrip()
K = int(input())

sk = S[K-1]

ans = ''
for s in S:
    if s != sk:
        ans += '*'
    else:
        ans += s

print(ans)

Submission status: Accepted

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

sk = s[k-1]

ans = []

for si in s:
    if si == sk:
        ans.append(si)
    else:
        ans.append("*")
        
print(*ans,sep="")

Submission status: Accepted

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

s = S[K-1]
for i in range(N):
    if S[i] != s:
        S[i] = "*"

print("".join(S))

Submission status: Accepted

Solution code:
n,s,i=input(),input(),int(input())-1
for S in s:
  if S!=s[i]:print("*",end='')
  else:print(s[i],end='')

Submission status: Accepted

Solution code:
n = int(input())
s = input()
a = int(input())
ans = ""
for i in range(n):
    if s[i] == s[a - 1]:
        ans += s[i]
    else:
        ans += "*"
print(ans)

Submission status: Accepted

Solution code:
'''
Created on 2020/08/20

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=int(pin())
  S=pin()[:-1]
  K=int(pin())
  t=S[K-1]
  for i in range(N):
    if t==S[i]:
      pout(t)
    else:
      pout("*")
  print()
  return 
main()

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n = I()
s = S()
k = I()
c = s[k-1]
ans = ''
for x in s:
    if x == c:
        ans += x
    else:
        ans += '*'
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
k=int(input())
ss = s[k-1]
for i in range(0,n):
  if s[i] != ss:
    s[i]='*'
print("".join(s))

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rf = lambda: map(float, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
s = rr()
k = ri()
a = s[k-1]
ans = ''
for i in s:
    if i == a:
        ans += a
    else:
        ans += '*'
print(ans)

Submission status: Accepted

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

t = s[k-1]

ans =''
for i in s:
    if i == t:
        ans += t
    else:
        ans += '*'

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
ans = ''
for i in range(n):
    if s[i] != s[k - 1]:
        ans += '*'
    else:
        ans += s[i]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
S=input()
K=int(input())
ans=""
for s in S:
    if s==S[K-1]:
        ans+=s
    else:
        ans+="*"
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
s=input()
k=int(input())
for i in s:
    if i==s[k-1]:
        print(i,end='')
    else:
        print('*',end='')

Submission status: Accepted

Solution code:
#Tenka1 Programmer Beginner Contest 2019 b
n=int(input())
s=input()
k=int(input())-1
x=s[k]
ans=""
for c in s:
    if c==x:
        ans+=c
    else:
        ans+="*"
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
K=int(input())
w=S[K-1]
for i in range(N):
    if S[i]!=w:
        S[i]='*'
print(''.join(S))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
t = s[k-1]
s = [c if c == t else "*" for c in s]
print("".join(s))

Submission status: Accepted

Solution code:
import re
n,s,k=[input()for _ in "nsk"]
print(re.sub(f"[^{s[int(k)-1]}]","*",s))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
ans = []
for i in range(n):
    if s[i] == s[k-1]:
        ans.append(s[k-1])
    else:
        ans.append('*')

print(*ans, sep='')

Submission status: Accepted

Solution code:
N = int(input())
S = input()
K = int(input())
ans = ""
for i in S:
  if i == S[K-1]:
    ans += i
  else:
    ans += "*"
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
ans = ""
for i in s:
  if i == s[k - 1]:
    ans += i
  else:
    ans += "*"
print(ans)

Submission status: Accepted

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

anchor = S[K-1]
ans = ""
for i in range(N):
    if S[i] != anchor:
        ans += '*'
    else:
        ans += anchor

print(ans)

Submission status: Accepted

Solution code:
n = int (input ())
s = input ()
k = int (input ())
x = s[k-1]
for i in range (n):
  if s[i] == x:
    continue
  else:
    s = s.replace(s[i], '*')
print (s)

Submission status: Accepted

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

c = S[k-1]
ans = str()
for s in S:
    if s == c:
        ans += s
    else:
        ans += "*"

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
K = int(input())
ans = ''
for i in S:
    if i == S[K-1]:
        ans += S[K-1]
    else:
        ans += '*'
print(ans)

Submission status: Accepted

Solution code:
N, S, K = open(0).read().split()
N = int(N)
K = int(K)
ck = S[K - 1]
ans = [c if c == ck else "*" for c in list(S)]
print("".join(ans))

Submission status: Accepted

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

s = S[K-1]
ans = ""
for i in range(N):
    if S[i]!=s:
        ans = ans + "*"
    else:
        ans = ans + s

print(ans)

Submission status: Accepted

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

a = []
for i in s:
    
    if i != s[k-1]:
        a.append('*')
    else:
        a.append(i)

print(*[i for i in a],sep='')

Submission status: Accepted

Solution code:
from os import replace


n = int(input())
s = input()
k = int(input())
replace = s[k - 1]
for i in range(n):
    if s[i] == replace:
        print(s[i],end="")
    else:
        print("*",end="")
print()

Submission status: Accepted

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

m = s[k-1]
for ss in s:
    if ss != m:
        print("*", end="")
    else:
        print(ss, end="")
print()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
pivot = s[int(input())-1]

for c in s:
  print(c if c == pivot else '*', end='')
  
print()

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
K = int(input())-1

ans = ''
p = S[K]
for i in range(N):
    if p == S[i]:
        ans += S[i]
    else:
        ans += '*'

print(ans)

Submission status: Accepted

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

x = s[k - 1]

for i in range(n):
    if s[i] == x:
        ans = ans + s[i]
    else:
        ans = ans + "*"

print(ans)

Submission status: Accepted

Solution code:
'''     ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█  
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     '''


# [temp1.py] => [29-07-2020 @ 10:25:10] 
# Author & Template by : Udit "luctivud" Gupta
# https://www.linkedin.com/in/udit-gupta-1b7863135/


import math;   from collections import *
import sys;    from functools import reduce
import time;   from itertools import groupby

# sys.setrecursionlimit(10**6)

def input()         : return sys.stdin.readline()
def get_ints()      : return map(int, input().strip().split())
def get_list()      : return list(get_ints())
def get_string()    : return list(input().strip().split())
def printxsp(*args) : return print(*args, end="")
def printsp(*args)  : return print(*args, end=" ")


DIRECTIONS = [(+0, +1), (+0, -1), (+1, +0), (+1, -1)] 
NEIGHBOURS = [(-1, -1), (-1, +0), (-1, +1), (+0, -1),\
              (+1, +1), (+1, +0), (+1, -1), (+0, +1)]


CAPS_ALPHABETS = {chr(i+ord('A')) : i for i in range(26)}
SMOL_ALPHABETS = {chr(i+ord('a')) : i for i in range(26)}
INF = float('inf')


# Custom input output is now piped through terminal commands.
# for _test_ in range(int(input())): 
n = int(input())
s = input().strip('\n')
k = int(input())
target = s[k-1]

for i in s:
	if i != target:
		printxsp('*')
	else:
		printxsp(target)





# print("Time Elapsed: {}".format(float(S34p-S34t)))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
K = int(input())
ans = ""
for i in range(N):
  if S[i]==S[K-1]:
    ans+=S[i]
  else:
    ans+="*"
print(ans)

Submission status: Accepted

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

c = S[K-1]
ans = ''

for i in range(N):
    if S[i] != c:
        ans += '*'
    else:
        ans += c

print(ans)

Submission status: Accepted

Solution code:
input()
S = input()
K = int(input())
for s in S:
    print('*' if s != S[K-1] else s, end='')

Submission status: Accepted

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

ans = ""
for c in s:
  if c == s[n - 1:n]:
    ans += c
  else:
    ans += "*"
    
print(ans)

Submission status: Accepted

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

for i in range(n):
    if s[i] != s[k-1]:
        s[i] = '*'
print(''.join(s))

Submission status: Accepted

Solution code:
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    [n, s, k] = [str(readline().rstrip()) for _ in range(3)]
    s = list(s)
    strS = ""
    target = s[int(k) - 1]
    for i in range(int(n)):
        if s[i] == target:
            strS += s[i]
        else:
            strS += "*"
    print(strS)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
S=input()
K=int(input())
ans=[]
for i in range(N):
  if S[i]!=S[K-1]:
    s="*"
  else:
    s=S[K-1]
  ans.append(s)
print("".join(ans))

Submission status: Accepted

Solution code:
n = int(input())
s = list(input())
k = int(input()) - 1

for i in range(n):
    if s[i] != s[k]:
        s[i] = "*"
        
print(*s,sep="")

Submission status: Accepted

Solution code:
input()
s = input()
k = int(input()) - 1
print(''.join(c if c == s[k] else '*' for c in s))

Submission status: Accepted

Solution code:
import sys, math
from collections import deque
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    S = input()
    K = ii()
    ans = ''.join([S[i] if S[i] == S[K-1] else '*' for i in range(N)])
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
s=input()
k=int(input())-1
t=s[k]
ans=""
for i in range(n):
    if s[i]!=t:
        ans+="*"
    else:
        ans+=s[i]
print(ans)

Submission status: Accepted

Solution code:
import re
n = int(input())
s = input()
k = int(input())

ans = re.sub(rf'[^{s[k-1]}]', '*', s)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
K = int(input())
t = S[K-1]
ans = ""
for s in S:
  if s == t:
    ans += s
  else:
    ans += "*"
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
S = input()
K = int(input())
ans = ["*"]*N
SK = S[K-1]
for i in range(N):
    if SK == S[i]:
        ans[i] = SK
for i in ans:
    print(i,end="")

Submission status: Accepted

Solution code:
N = int(input())
S = input()
K = int(input())
e = S[K-1]
ans = []
for i in range(N):
  if S[i] != e:
    ans.append("*")
  else:
    ans.append(S[i])
print(''.join(ans))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    S = input()
    k = S[int(input()) - 1]
    ans = [s if s == k else '*' for s in S]
    print(''.join(ans))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = ""
for s in S:
    if S[K-1] == s:
        ans += s
    else:
        ans += "*"
print(ans)

Submission status: Accepted

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

S_kth = S[K-1]
for i in range(N):
    if S[i] != S_kth:
        S[i] ='*'
print(*S, sep='')

Submission status: Accepted

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

target = s[k - 1]
res = []
for alp in s:
    if alp == target:
        res.append(alp)
    else:
        res.append('*')

print(''.join(res))

Submission status: Accepted

Solution code:
n=int(input())
s=list(input())
k=int(input())
char=s[k-1]
for i in range(n):
    if s[i]!=char:
        s[i]="*"
print("".join(s))

Submission status: Accepted

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

v = s[k-1]

ary = []

for i in s:
  if i != v:
    ary.append('*')
  else:
    ary.append(v)
print (''.join(ary))

Submission status: Accepted

Solution code:
N = int(input())
S = input()
s = S[int(input())-1]

ans = ""
for i in S:
  if i == s:
    ans += s
  else:
    ans += "*"
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
S=input()
K=int(input())
s=S[K-1]
L=[]
for i in range(N):
    if s!=S[i]:
        L.append('*')
    else:
        L.append(s)
print(*L,sep='')

Submission status: Accepted

Solution code:
N=int(input())
S=list(input())
K=int(input())
s=S[K-1]
for i in range(N):
    if S[i]!=s:
        S[i]='*'
print(''.join(S))

Submission status: Accepted

Solution code:
n, s, k = [input() for i in range(3)]
target = s[int(k)-1]
s = list(s)
for i in range(int(n)):
  if s[i] != target:
    s[i] = '*'
print("".join(s))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    S = input().rstrip()
    K = int(input())

    ans = ""
    T = S[K - 1]
    for s in S:
        if s == T:
            ans = ans + T
        else:
            ans = ans + "*"

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
s=input()
k=int(input())
tar=s[k-1]
for c in s:
  if c!=tar: print("*",end="")
  else: print(c,end="")

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
r = ""
for i in s:
  if i == s[k-1]:
    r += i
  else:
    r+='*'
print(r)

Submission status: Accepted

Solution code:
n = input()
s = input()
i = int(input())
 
l = list(s)
for j, c in enumerate(l):
  if c != s[i-1]:
    l[j] = '*'
    
l = ''.join(l)
 
print(l)

Submission status: Accepted

Solution code:
N = int(input())
S = str(input())
K = int(input())
s =[]
for i in range(len(S)):
    if S[i] ==S[K-1]:
        s.append(S[i])
    else:
        s.append('*')
print(''.join(s))

Submission status: Accepted

Solution code:
N = int(input())
S = list(input())
K = int(input())
for i in range(N):
  if S[i] != S[K-1]:
    S[i] = '*'
print(''.join(S))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
p = s[k - 1]
ans = ''
for i in range(n):
  if s[i] != p:
    ans += '*'
  else:
    ans += p
print(ans)

Submission status: Accepted

Solution code:
import re
n = int(input())
s = input()
k = int(input())
s = re.sub('[^%s]' % s[k-1], '*', s)
print(s)

Submission status: Accepted

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

for i in range(N):
  if S[i]!=S[K-1]:
    S = S.replace(S[i], "*")
  
print(S)

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
k = int(input())
for i in s:
    if i != s[k-1]:
        print("*",end = "")
    else:
        print(i,end = "")

Submission status: Accepted

Solution code:
n = int(input())
rawa = input()
n1 = int(input())
a = ""
b = rawa[n1-1]
for i in range(n):
  if rawa[i] == b:
    a += b
  else:
    a += "*"
print(a)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
t = s[k - 1]
res = ''
for i in range(n):
  if s[i] == t:
    res += s[i]
  else:
    res += '*'
print(res)

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
t = s[k-1]
l = []

for i in range(n):
    if s[i] == t:
        l.append(t)
    else:
        l.append('*')

print(''.join(l))

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
k = int(input())
c = s[k-1]
ans = ''
for x in s:
    if x == c:
        ans += x
    else:
        ans += '*'
print(ans)

Submission status: Accepted

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

res = ''

for i in range(n):
    if s[i] == s[k-1]:
        res+=s[k-1]
    else:
        res+='*'
print(res)

Submission status: Accepted

Solution code:

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    S=list(input())
    K=I()
    K-=1
    s=S[K]
    for i in range(N):
        if S[i]!=s:
            S[i]="*"
            
    print(''.join(map(str, S)))

main()

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
k -= 1

import re
print(re.sub('[^' + s[k] + ']', '*', s))

Submission status: Accepted

Solution code:
n = int(input())
s = input()
k = int(input())
t = s[k - 1]
ans = ""
for si in s:
    if si == t:
        ans += si
    else:
        ans += "*"
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = list(str(input()))
k = int(input())
k -= 1
for i in range(n):
    if s[i] != s[k]:
        s[i] = '*'
print(''.join(s))

Submission status: Accepted

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

for c in s:
    if c == s[k - 1]:
        print(c, end="")
    else:
        print("*", end="")

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    S = SS()
    K = I()

    ans = []
    S_k = S[K-1]
    for i in S:
        if i == S_k:
            ans.append(i)
        else:
            ans.append('*')

    print(''.join(ans))

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    S = SS()
    K = I()

    ans = ''
    S_k = S[K-1]
    for i in S:
        if i == S_k:
            ans += i
        else:
            ans += '*'

    print(ans)

if __name__ == '__main__':
    resolve()