ZhenlongDai/ACPR huggingface dataset:
Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
a = int(input())
a_list = []
for i in range(a):
    a_list.append(int(input()))
max_num = max(a_list)
if a_list.count(max_num) != 1:
    for i in range(a):
        print(max_num)
        sys.exit()
else:
    sec_num = sorted(a_list)[-2]
for i in a_list:
    if i == max_num:
        print(sec_num)
    else:
        print(max_num)

Failing test case input:
2
8
8

Expected output:
8
8


Actual output:
8


Fixed submission (verdict: Accepted):
import sys
a = int(input())
a_list = []
for i in range(a):
    a_list.append(int(input()))
max_num = max(a_list)
if a_list.count(max_num) != 1:
    for i in range(a):
        print(max_num)
else:
    sec_num = sorted(a_list)[-2]
    for i in a_list:
        if i == max_num:
            print(sec_num)
        else:
            print(max_num)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
ls=[]
for i in range(n):
    ls.append(int(input()))

llss=ls
for i in range(n):
    llss.sort()
    if llss[n-2]==llss[i]:
        print(llss[n-1])
    else:
        print(llss[n-2])


Failing test case input:
3
0
-1
3

Expected output:
3
3
0


Actual output:
0
3
0


Fixed submission (verdict: Accepted):
n=int(input())
ls=[]
for i in range(n):
    ls.append(int(input()))

llss=sorted(ls)
for i in range(n):
    if llss[n-1]==ls[i]:
        print(llss[n-2])
    else:
        print(llss[n-1])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
nums = [input() for i in range(N)]

_nums = sorted(nums, reverse=True)
max1 = _nums[0]
max2 = _nums[1]
for i in range(0, N):
    if nums[i] == max1:
        print(max2)
    else:
        print(max1)


Failing test case input:
3
1
5
13

Expected output:
13
13
5


Actual output:
5
13
5


Fixed submission (verdict: Accepted):
N = int(input())
nums = [int(input()) for i in range(N)]

_nums = sorted(nums, reverse=True)
max1 = _nums[0]
max2 = _nums[1]
for i in range(0, N):
    if nums[i] == max1:
        print(max2)
    else:
        print(max1)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = []

maxa = 0
maxa1 = 0
maxcnt = 0
for i in range(n):
    ai = int(input())
    a.append(ai)
    if maxa < ai:
        maxa1 = maxa
        maxa = ai
        maxcnt = 0
    elif maxa == ai:
        maxcnt += 1

for i in range(n):
    if a[i] == maxa:
        if maxcnt > 0:
            print(maxa)
        else:
            print(maxa1)
    else:
        print(maxa)


Failing test case input:
3
1
9
2

Expected output:
9
2
9


Actual output:
9
1
9


Fixed submission (verdict: Accepted):
n = int(input())
a = []

maxa = 0
maxa1 = 0
maxcnt = 0
for i in range(n):
    ai = int(input())
    a.append(ai)
    if maxa < ai:
        maxa1 = maxa
        maxa = ai
        maxcnt = 0
    elif maxa == ai:
        maxcnt += 1
    elif maxa1 < ai:
        maxa1 = ai

for i in range(n):
    if a[i] == maxa:
        if maxcnt > 0:
            print(maxa)
        else:
            print(maxa1)
    else:
        print(maxa)
Problem: p02971
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
maxA = 0
secondMaxA = 0
maxIndex = -1
for i in range(N):
  A = int(input())
  if A >= maxA:
    secondMaxA = maxA
    maxA = A
    maxIndex = 1
  elif A >= secondMaxA:
    secondMaxA = A

for i in range(N):
  if i == maxIndex:
    print(secondMaxA)
  else:
    print(maxA)

Failing test case input:
3
0
5
8

Expected output:
8
8
5


Actual output:
8
5
8


Fixed submission (verdict: Accepted):
N = int(input())
maxA = 0
secondMaxA = 0
maxIndex = -1
for i in range(N):
  A = int(input())
  if A >= maxA:
    secondMaxA = maxA
    maxA = A
    maxIndex = i
  elif A >= secondMaxA:
    secondMaxA = A

for i in range(N):
  if i == maxIndex:
    print(secondMaxA)
  else:
    print(maxA)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A)

for i in range(N):
    if B[-1] == A[i-1]:
        print(B[-2])
    else:
        print(B[-1])

Failing test case input:
3
0
4
13

Expected output:
13
13
4


Actual output:
4
13
13


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for i in range(N)]
B = sorted(A)

for i in range(N):
    if B[-1] == A[i]: 
        print(B[-2])
    else:
        print(B[-1])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

a = []
aa = []

for i in range(n):
    ai = int(input())
    a.append(ai)
    aa.append(ai)

aa.sort()
firsta = aa[0]
seconda = aa[1]

for i in range(n):
    if a[i] == firsta:
        print(seconda)
    else:
        print(firsta)



Failing test case input:
3
1
5
7

Expected output:
7
7
5


Actual output:
5
1
1


Fixed submission (verdict: Accepted):
n = int(input())

a = []
aa = []

for i in range(n):
    ai = int(input())
    a.append(ai)
    aa.append(ai)

aa.sort()
firsta = aa[-1]
seconda = aa[-2]


if firsta == seconda:
    for i in range(n):
        print(firsta)
else:
    for i in range(n):
        if a[i] == firsta:
            print(seconda)
        else:
            print(firsta)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[int(input()) for i in range(n)]
max1=sorted(a)[-1]
if sorted(a)[-2]!=max1:
    max=sorted(a)
    max2=0
    for i in range(2,n):
        if max[-i]!=max1:
            max2=max[-i]
            break
    for i in range(n):
        if a[i]==max1:
            print(max2)
        else:
            print(max1)
else:
    for i in range(n):
        print(max1)


Failing test case input:
2
3
4

Expected output:
4
3


Actual output:
4
0


Fixed submission (verdict: Accepted):
n=int(input())
a=[int(input()) for i in range(n)]
max1=sorted(a)[-1]
if n==2:
    print(a[1])
    print(a[0])
elif sorted(a)[-2]!=max1:
    max=sorted(a)
    max2=0
    for i in range(2,n):
        if max[-i]!=max1:
            max2=max[-i]
            break
    for i in range(n):
        if a[i]==max1:
            print(max2)
        else:
            print(max1)
else:
    for i in range(n):
        print(max1)
Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy

N = int(input())
a = []
for i in range(N):
  a.append(int(input()))

s = copy.copy(a)
s.sort()

print(s)

for l in a:
  if(l >= s[-1]):
    print(s[-1])
  else:
    print(s[-2])

Failing test case input:
3
1
9
2

Expected output:
9
2
9


Actual output:
[1, 2, 9]
2
9
2


Fixed submission (verdict: Accepted):
from copy import deepcopy

N = int(input())
a = []
for i in range(N):
    a.append(int(input()))

s = deepcopy(a)
s.sort()


for l in a:
    if(l != s[-1]):
        print(s[-1])
    else:
        print(s[-2])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
A=[int(input()) for i in range(n)]
B=sorted(A)
for a in A:
    if a == B[-1]:
      print(B[-1])
    else:
        print(B[-2])

Failing test case input:
3
-1
4
0

Expected output:
4
0
4


Actual output:
0
4
0


Fixed submission (verdict: Accepted):
n=int(input())
A=[int(input()) for i in range(n)]
B=sorted(A)
for a in A:
    if a == B[-1]:
      print(B[-2])
    else:
        print(B[-1])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(input()) for _ in range(n)]
sorted_a = sorted(a)
for i in range(n):
    if a[i] != sorted_a[-1]:
        print(sorted_a[-2])
    else:
        print(sorted_a[-1])


Failing test case input:
3
1
5
0

Expected output:
5
1
5


Actual output:
1
5
1


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(input()) for _ in range(n)]
sorted_a = sorted(a)
for i in range(n):
    if a[i] != sorted_a[-1]:
        print(sorted_a[-1])
    else:
        print(sorted_a[-2])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


N = int(input())
A_max = 0
A_max_s = 0
flag = 0
A = []

for i in range(N):
    a = int(input())
    A.append(a)
    if a > A_max:
        A_max = a
        ind_max = i
    elif A_max_s < a < A_max:
        A_max_s = a
    elif a == A_max:
        flag += 1
        
if flag >= 1:
    for i in range(N):
        print(A_max)
elif flag == 0:
    for i in range(N):
        if i != ind_max:
            print(A_max)
        else:
            print(A_max_s)

    
    

Failing test case input:
3
1
2
12

Expected output:
12
12
2


Actual output:
12
12
0


Fixed submission (verdict: Accepted):


N = int(input())
A_max = 0
A_max_s = 0
flag = 0
A = []

for i in range(N):
    a = int(input())
    A.append(a)
    if a > A_max:
        A_max_s = A_max
        A_max = a
        ind_max = i
        flag = 0
    elif A_max_s < a < A_max:
        A_max_s = a
    elif a == A_max:
        flag += 1
        
if flag >= 1:
    for i in range(N):
        print(A_max)
elif flag == 0:
    for i in range(N):
        if i != ind_max:
            print(A_max)
        else:
            print(A_max_s)
Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(N)]
a = sorted(set(A))
max_count = A.count(a[-1])
for i in range(N):
  if len(a) > 1:
    if A[i] != a[-1]:
      print(a[-1])
    else:
      if max_count < 1:
        print(a[-1])
      else:
        print(a[-2])
  else:
    print(a[-1])

Failing test case input:
3
3
-2
3

Expected output:
3
3
3


Actual output:
-2
3
-2


Fixed submission (verdict: Accepted):
N = int(input())
A = [int(input()) for _ in range(N)]
a = sorted(set(A))
max_count = A.count(a[-1])

for i in range(N):
  if len(a) > 1:
    if A[i] != a[-1]:
      print(a[-1])
    else:
      if max_count > 1:
        print(a[-1])
      else:
        print(a[-2])
  else:
    print(a[-1])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(input()) for i in range(n)]
mx = max(a)
mxi = a.index(mx)
mx2 = a[:mxi] + a[mxi+1:]

for i in range(n):
    if i == mxi: print(mx2) 
    else: print(mx)


Failing test case input:
3
0
1
11

Expected output:
11
11
1


Actual output:
11
11
[0, 1]


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(input()) for i in range(n)]
mx = max(a)
mxi = a.index(mx)
mx2 = max(a[:mxi] + a[mxi+1:])

for i in range(n):
    if i == mxi: print(mx2) 
    else: print(mx)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
a = [int(input()) for i in range(N-1)]
s = sorted(a)
for i in range(N-1):
  if s[0]==s[i]:
    print(s[0])
  else:
    print(s[1])
    

Failing test case input:
3
1
8
2

Expected output:
8
2
8


Actual output:
1
8


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(input()) for i in range(N)]
s = sorted(a,reverse=True)
for i in range(N):
  if s[0]!=a[i]:
    print(s[0])
  else:
    print(s[1])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[int(input()) for _ in range(n)]
amax=max(a)
a.remove(amax)
bmax=max(a)
a.append(amax)
for i in range(n):
  if max(a)==a[i]:
    print(bmax)
  else:
    print(amax)
  


Failing test case input:
2
5
2

Expected output:
2
5


Actual output:
5
2


Fixed submission (verdict: Accepted):
n=int(input())
a=[int(input()) for _ in range(n)]

amax,b=max(a),a.index(max(a))
a.remove(amax)
bmax=max(a)
for i in range(n):
  if i==b:
    print(bmax)
  else:
    print(amax)

Problem: p02971
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
temp = []
for i in range(n):
	temp.append(int(input()))

sort = temp[:]

sort.sort()

maximum = sort[-1]

print(maximum)

for i in temp:
	if i != maximum:
		print(maximum)

	else:
		print(sort[-2])



Failing test case input:
2
8
8

Expected output:
8
8


Actual output:
8
8
8


Fixed submission (verdict: Accepted):
n = int(input())
temp = []
for i in range(n):
	temp.append(int(input()))

sort = temp[:]

sort.sort()

maximum = sort[-1]


for i in temp:
	if i != maximum:
		print(maximum)

	else:
		print(sort[-2])
Problem: p02971
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
a = [input() for _ in range(n)]

max_1st = sorted(a)[-1]
max_2nd = sorted(a)[-2]
for i in range(n):
    if a[i] == max_1st:
        print(max_2nd)
    else:
        print(max_1st)


Failing test case input:
3
1
5
13

Expected output:
13
13
5


Actual output:
5
13
5


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(input()) for _ in range(n)]

max_1st = max(a)
max_2nd = sorted(a)[-2]
for i in range(n):
    if a[i] == max_1st:
        print(max_2nd)
    else:
        print(max_1st)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

max_A = max(A)
sorted_A = list(sorted(list(set(A))))
for i in range(N):
    if A[i] == max_A:
        print(sorted_A[len(sorted_A)-2])
    else:
        print(max_A)


Failing test case input:
3
2
4
4

Expected output:
4
4
4


Actual output:
4
2
2


Fixed submission (verdict: Accepted):
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

max_A = max(A)
semimax_A = max_A if A.count(max_A) > 1 else list(sorted(list(set(A))))[-2]
for i in range(N):
    if A[i] == max_A:
        print(semimax_A)
    else:
        print(max_A)

Problem: p02971
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
a = [int(input()) for i in range(n)]

b = sorted(a)

if b[-1]==b[-2]:
    for i in range(n):
        print(b[-1])
else:
    for i in range(n):
        if b[i]==a[-1]:
            print(b[-2])
        else:
            print(b[-1])


Failing test case input:
3
3
6
3

Expected output:
6
3
6


Actual output:
3
3
6


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(input()) for i in range(n)]

b = sorted(a)

if b[-1]==b[-2]:
    for i in range(n):
        print(b[-1])
else:
    for i in range(n):
        if a[i]==b[-1]:
            print(b[-2])
        else:
            print(b[-1])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())
a = [int(input()) for _ in range(n)]
a_max_1 = max(a)
a_max_2 = a_max_1
b = sorted(a, reverse=True)
for i in b:
    if i != a_max_1:
        a_max_2 = i
        break

for i in range(n):
    if a[i] == a_max_1:
        print(a_max_2)
    else:
        print(a_max_1)


Failing test case input:
3
3
-2
3

Expected output:
3
3
3


Actual output:
-2
3
-2


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())
a = [int(input()) for _ in range(n)]
a_max_1 = max(a)
b = sorted(a, reverse=True)
a_max_2 = b[1]

for i in range(n):
    if a[i] == a_max_1:
        print(a_max_2)
    else:
        print(a_max_1)
Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys
N=int(input())
a=[0]*(N)
maxim=[0]*(N)
for i in range(N):
    a[i]=int(input())
maxim=sorted(list(set(a)), reverse=True)
if len(maxim)==1:
    for j in range(N):
        print(maxim[0])
        sys.exit()

for k in range(N):
    if a[k]!=maxim[0]:
        print(maxim[0])
    else:
        print(maxim[1])

Failing test case input:
2
8
8

Expected output:
8
8


Actual output:
8


Fixed submission (verdict: Accepted):
N=int(input())
a=[0]*(N)
maxim=[0]*(N)
for i in range(N):
    a[i]=int(input())
maxim=sorted(list(a), reverse=True)
for k in range(N):
    if a[k]!=maxim[0]:
        print(maxim[0])
    else:
        print(maxim[1])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
l = [int(input()) for i in range(n)]
la = sorted(l, reverse=True)
print(l)
m1 = la[0]
m2 = la[1]
for i in l:
    if i == m1:
        print(m2)
    else:
        print(m1)

Failing test case input:
3
1
5
2

Expected output:
5
2
5


Actual output:
[1, 5, 2]
5
2
5


Fixed submission (verdict: Accepted):
n = int(input())
l = [int(input()) for i in range(n)]
la = sorted(l, reverse=True)
m1 = la[0]
m2 = la[1]
for i in l:
    if i == m1:
        print(m2)
    else:
        print(m1)

Problem: p02971
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
L=[int(input()) for i in range(N)]
tl=sorted(L)
index1=L.index(tl[-1])
index2=L.index(tl[-2])
for i in range(N-1):
	if i==index1:
		print(L[index2])
	print(L[index1])

Failing test case input:
3
0
1
7

Expected output:
7
7
1


Actual output:
7
7


Fixed submission (verdict: Accepted):
N=int(input())
L=[int(input()) for i in range(N)]
tl=sorted(L)
index1=L.index(tl[-1])
index2=L.index(tl[-2])
for i in range(N):
	if i==index1:
		print(L[index2])
	else:
		print(L[index1])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import copy

def main():

    N = int(input())
    A = [int(input()) for _ in range(N)]

    srtdA = copy.copy(list(set(A)))
    srtdA.sort(reverse=True)

    for  i in range(N):
        if A[i] != srtdA[0]:
            print(srtdA[0])
        else:
            if len(srtdA)==1:
                print(srtdA[0])
            else:
                print(srtdA[1])

if __name__== "__main__":
    main() 


Failing test case input:
3
2
4
4

Expected output:
4
4
4


Actual output:
4
2
2


Fixed submission (verdict: Accepted):
import copy

def main():

    N = int(input())
    A = [int(input()) for _ in range(N)]

    srtdA = copy.copy(A)
    srtdA.sort(reverse=True)
    atmax = srtdA[0]
    atsecond = srtdA[1]


    for  a in A:
        if a==atmax:
            print(atsecond)
        else:
            print(atmax)

if __name__== "__main__":
    main()
Problem: p02971
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import copy
N = int(input())
A = [int(input()) for i in range(N)]
set_A = list(set(A))
set_A.sort(reverse=True)
A_copy = copy.deepcopy(A)
A_copy.sort(reverse=True)
Max = max(A)
if len(set_A) == 1:
    for i in range(len(set_A)):
        print(Max)
    exit()
for i in range(N):
    if A[i] == Max:
        print(A_copy[1])
    else:
        print(Max)

Failing test case input:
2
5
5

Expected output:
5
5

Actual output:
5


Fixed submission (verdict: Accepted):
import copy
N = int(input())
A = [int(input()) for i in range(N)]
set_A = list(set(A))
set_A.sort(reverse=True)
A_copy = copy.deepcopy(A)
A_copy.sort(reverse=True)
Max = max(A)
cnt = 0
for i in range(N):
    if A[i] == Max:
        cnt += 1
for i in range(N):
    if A[i] == Max:
        if cnt > 1:
            print(Max)
        else:
            print(set_A[1])
    else:
        print(Max)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
max = max(A)
max2 = sorted(A)[-2]
print(A)
for i in A:
    if i == max:
        print(max2)
    else:
        print(max)


Failing test case input:
3
0
12
0

Expected output:
12
0
12


Actual output:
[0, 12, 0]
12
0
12


Fixed submission (verdict: Accepted):
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
max = max(A)
max2 = sorted(A)[-2]
if max == max2:
    for i in A:
        print(max)
else:
    for i in A:
        if i == max:
            print(max2)
        else:
            print(max)

Problem: p02971
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list()
for x in range(n):
    a.append(int(input()))

copy_a = sorted(a)

a.sort(reverse=True)
A_Max = a[0]
A_Second = a[1]

for x in range(n):
    if copy_a[x] == A_Max:
        print(A_Second)
    else:
        print(A_Max)


Failing test case input:
3
-1
4
1

Expected output:
4
1
4


Actual output:
4
4
1


Fixed submission (verdict: Accepted):
n = int(input())
a = list()
for x in range(n):
    a.append(int(input()))

copy_a = sorted(a, reverse=True)

A_Max = copy_a[0]
A_Second = copy_a[1]

for x in range(n):
    if a[x] == A_Max:
        print(A_Second)
    else:
        print(A_Max)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input()) 
s = [input() for i in range(N)] 

buf = s.copy()
max_ind = s.index(max(s))
max_num = max(s)
s.pop(max_ind)
max2_num = max(s)
 
for i in range(N):
    if buf[i] == max_num:
        print(max2_num)
    else:
        print(max_num)

Failing test case input:
3
0
4
13

Expected output:
13
13
4


Actual output:
4
13
4


Fixed submission (verdict: Accepted):
N = int(input()) 
s = []
s = [int(input()) for i in range(N)] 

max_num = max(s)
max_ind = s.index(max_num)
s.remove(max_num)
max2_num = max(s)
 
for i in range(N):
    if i == max_ind:
        print(max2_num)
    else:
        print(max_num)
Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
A =[int(input()) for i in range(N)]
B=A
B.sort()
for x in range(0,N):
    if A[x]!=B[-1]:
        print(A[-1])
    if A[x]==B[-1]:
        print(A[-2])



Failing test case input:
3
1
5
3

Expected output:
5
3
5


Actual output:
5
5
3


Fixed submission (verdict: Accepted):
N=int(input())
A =[int(input()) for i in range(N)]
B=sorted(A)
for x in range(0,N):
    if A[x]!=B[-1]:
        print(B[-1])
    if A[x]==B[-1]:
        print(B[-2])

Problem: p02971
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
L=[]
i = 0
s = 0
M2 = 0
a = 0
for i in range (0,N):
    L.append(int(input()))
M = L[0]
for s in range(1,N):
    if  L[s] > M:
        M = L[s]
for s in range(1,N):
    if L[s] == M:
        a += 1
        continue
    else:
        if L[s] > M2:
            M2 = L[s]
for i in range(0,N):
    if L[i] == M and a == 1:
        print(M2)
    else:
        print(M)


Failing test case input:
2
5
1

Expected output:
1
5


Actual output:
5
5


Fixed submission (verdict: Accepted):
N = int(input())
L=[]
i = 0
s = 0
M2 = 0
a = 0
for i in range (0,N):
    L.append(int(input()))
M = L[0]
for s in range(1,N):
    if  L[s] > M:
        M = L[s]
for s in range(0,N):
    if L[s] == M:
        a += 1
    else:
        if L[s] > M2:
            M2 = L[s]
for i in range(0,N):
    if L[i] == M and a < 2:
        print(M2)
    else:
        print(M)

Problem: p02971
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    m = max(a)
    s = sorted(a)[1]
    for i in a:
        if i == m:
            print(s)
        else:
            print(m)

if __name__=="__main__":
    main()


Failing test case input:
2
5
3

Expected output:
3
5


Actual output:
5
5


Fixed submission (verdict: Accepted):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    n = int(input())
    a = [int(input()) for _ in range(n)]
    m = max(a)
    s = sorted(a)[-2]
    for i in a:
        if i == m:
            print(s)
        else:
            print(m)

if __name__=="__main__":
    main()

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

A = []
max1 = 0
max2 = 0
for _ in range(N):
    ai = int(input())
    A.append(ai)


A2 = sorted(A)

max1 = A2[len(A2)-1]
max2 = A2[len(A2)-2]
print(max1, max2)

for i in range(N):
    if max1 == A[i]:
        print(max2)
    else:
        print(max1)

Failing test case input:
3
1
2
3

Expected output:
3
3
2


Actual output:
3 2
3
3
2


Fixed submission (verdict: Accepted):
N = int(input())

A = []
max1 = 0
max2 = 0
for _ in range(N):
    ai = int(input())
    A.append(ai)


A2 = sorted(A)

max1 = A2[len(A2)-1]
max2 = A2[len(A2)-2]

for i in range(N):
    if max1 == A[i]:
        print(max2)
    else:
        print(max1)
Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
li = []


for i in range(N):
    li.append(input())

new_li = sorted(li, reverse=True)

M = new_li[0]
m = new_li[1]

for i in range(N):
    if li[i] != M:
        print(M)
    else:
        print(m)

Failing test case input:
3
1
5
10

Expected output:
10
10
5


Actual output:
5
10
5


Fixed submission (verdict: Accepted):
N = int(input())
li = []

for i in range(N):
    li.append(int(input()))

new_li = sorted(li, reverse=True)

M = new_li[0]
m = new_li[1]

for i in range(N):
    if li[i] != M:
        print(M)
    elif li[i] == M:
        print(m)

Problem: p02971
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=[]
for i in range(n):
    a.append(input())
sort_a=sorted(a,reverse=True)
if sort_a[0]==sort_a[1]:
    for _ in range(n):
        print(sort_a[0]) 
else:
    for i in range(n):
        if a[i]==sort_a[0]:
            print(sort_a[1])
        else:
            print(sort_a[0])

Failing test case input:
3
1
2
11

Expected output:
11
11
2


Actual output:
2
11
2


Fixed submission (verdict: Accepted):
n=int(input())
a=[]
for _ in range(n):
    a.append(int(input()))
sort_a=sorted(a,reverse=True)
for i in range(n):
    if a[i]==sort_a[0]:
        print(sort_a[1])
    else:
        print(sort_a[0])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [0] * n
for i in range(n):
  a[i] = int(input())

for i in range(n):
  for j in range(n):
    b = [0] * n
    if j != i:
      continue
    b[j] = a[j]
  print(max(b))

Failing test case input:
3
2
10
0

Expected output:
10
2
10


Actual output:
0
0
0


Fixed submission (verdict: Accepted):
n = int(input())
a = [0] * n
for i in range(n):
  a[i] = int(input())

asort = sorted(a,reverse=True)
for i in range(n):
  if a[i] == asort[0]:
    print(asort[1])
  else:
    print(asort[0])

Problem: p02971
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
a = [int(input()) for _ in range(n)]
a_max = max(a)
a_set = set(a)
second = sorted(set(a))[-2] if len(set(a)) >= 2 else a[0]
for i in a:
  if i == a_max:
    print(second)
  else:
    print(a_max)


Failing test case input:
3
2
4
4

Expected output:
4
4
4


Actual output:
4
2
2


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(input()) for _ in range(n)]
a_max = max(a)
second = sorted(a)[-2] if len(a) >= 2 else a[0]
for i in a:
  if i == a_max:
    print(second)
  else:
    print(a_max)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
nums = [input() for i in range(N)]

_nums = sorted(nums, reverse=True)
max1 = _nums[0]
max2 = _nums[1]
for i in range(0, N):
    if nums[i] == max1:
        print(max2)
    else:
        print(max1)

Failing test case input:
3
1
2
12

Expected output:
12
12
2


Actual output:
2
12
2


Fixed submission (verdict: Accepted):
N = int(input())
nums = [int(input()) for i in range(N)]

_nums = sorted(nums, reverse=True)
max1 = _nums[0]
max2 = _nums[1]
for i in range(0, N):
    if nums[i] == max1:
        print(max2)
    else:
        print(max1)
Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
l=[]
for i in range(n):
    x=int(input())
    l.append(x)
x=sorted(l)
for i in range(n):
    if l[i]==x:
        print(x[-2])
    else:
        print(x[-1])

Failing test case input:
3
4
0
0

Expected output:
0
4
4


Actual output:
4
4
4


Fixed submission (verdict: Accepted):
n=int(input())
l=[]
for i in range(n):
    x=int(input())
    l.append(x)
x=sorted(l)
for i in range(n):
    if l[i]==x[-1]:
        print(x[-2])
    else:
        print(x[-1])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
a=[]
for i in range(N):
    a.append(int(input()))

L_max=[0]*N
R_max=[0]*N

L=0
for i in range(N):
    L=max(L,a[i])
    L_max[i]=L

R=0
for i in range(N):
    R=max(R,a[-i-1])
    R_max[i]=R

for j in range(N):
    print(max(L_max[j-1],R_max[N-j-2]))
    

Failing test case input:
3
1
2
12

Expected output:
12
12
2


Actual output:
12
12
12


Fixed submission (verdict: Accepted):
N=int(input())
a=[]
for i in range(N):
    a.append(int(input()))

L_max=[0]*(N+1)
R_max=[0]*(N+1)

L=0
for i in range(N):
    L=max(L,a[i])
    L_max[i]=L

R=0
for i in range(N):
    R=max(R,a[-i-1])
    R_max[i]=R

for j in range(N):
    print(max(L_max[j-1],R_max[N-j-2]))

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

if A[0] > A[1]:
    max_1, max_2 = A[0],A[1]
else:
    max_1, max_2 = A[1],A[0]

dict = {}
for i, a in enumerate(A):
    if a in dict:
        dict[a] += 1
    else:
        dict[a] = 1
    if i >= 2:
        if a > max_1:
            max_1 = a
            max_2 = max_1
        elif a > max_2:
            max_2 = a

for a in A:
    if a == max_1:
        if dict[a] >= 2:
            print(max_1)
        else:
            print(max_2)
    else:
        print(max_1)




Failing test case input:
3
0
1
8

Expected output:
8
8
1


Actual output:
8
8
8


Fixed submission (verdict: Accepted):
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

if A[0] > A[1]:
    max_1, max_2 = A[0],A[1]
else:
    max_1, max_2 = A[1],A[0]

dict = {}
for i, a in enumerate(A):
    if a in dict:
        dict[a] += 1
    else:
        dict[a] = 1
    if i >= 2:
        if a > max_1:
            max_2 = max_1
            max_1 = a
        elif a > max_2:
            max_2 = a

for a in A:
    if a == max_1:
        if dict[a] >= 2:
            print(max_1)
        else:
            print(max_2)
    else:
        print(max_1)
Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = []
for i in range(N):
    A.append(int(input()))


for i in range(N):
    mx = 0
    if A[i] != max(A):
        print(max(A))
    else:
        for j in range(N):
            if (A[j] >= mx) & j != i:
                mx = A[j]
        print(mx)

Failing test case input:
3
-1
0
13

Expected output:
13
13
0


Actual output:
13
13
13


Fixed submission (verdict: Accepted):
N = int(input())
A = []

mx=0
for i in range(N):
    A.append(int(input()))

M = max(A)
    
if A.count(max(A)) > 1:
    for i in range(N):
        print(M)
else:
    for i in range(N):
        if A[i] != M:
            print(M)
        else:
            print(sorted(A)[-2])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

a = []
b = set()
for _ in range(n):
    tmp = int(input())
    a.append(tmp)
    b.add(tmp)

max_num = max(b)
max_num_set = set()
max_num_set.add(max_num)
c = b - max_num_set
if len(c) == 0:
    second_max_num = max_num
else:
    second_max_num = max(c)

for elem in a:
    if elem == max_num:
        print(second_max_num)
    else:
        print(max_num)


Failing test case input:
3
2
4
4

Expected output:
4
4
4


Actual output:
4
2
2


Fixed submission (verdict: Accepted):
n = int(input())

a = []
b = set()
for _ in range(n):
    tmp = int(input())
    a.append(tmp)
    b.add(tmp)

max_num = max(b)
c = b - {max_num}
if len(c) == 0 or a.count(max_num) >= 2:
    second_max_num = max_num
else:
    second_max_num = max(c)

for elem in a:
    if not elem == max_num:
        print(max_num)
    else:
        print(second_max_num)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
numList  = [input() for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Failing test case input:
3
1
5
13

Expected output:
13
13
5


Actual output:
5
13
5


Fixed submission (verdict: Accepted):
n = int(input())
numList  = [int(input()) for i in range(n)]
maxVal = max(numList)
workList = numList[:]
workList.remove(maxVal)
secondVal = max(workList)
for num in numList:
  if num != maxVal:
    print(maxVal)
  else:
    print(secondVal)

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = []
for _ in range(N):
  A.append(int(input()))
  
maxA = max(A)
for i in range(N):
  if A[i] == maxA:
    print(max(A[:i], A[i+1:])[0])
  else:
    print(max(A[i], maxA))



Failing test case input:
3
0
1
13

Expected output:
13
13
1


Actual output:
13
13
0


Fixed submission (verdict: Accepted):
N = int(input())
A = []
for _ in range(N):
  A.append(int(input()))
  
maxA = sorted(A, reverse=True)
maxA1 = maxA[0]
maxA2 = maxA[1]

for i in range(N):
  if A[i] == maxA1:
    print(maxA2)
  else:
    print(maxA1)
Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import heapq

n = int(input())
a = [int(input()) for i in range(n)]
b = heapq.nlargest(2, set(a))
c = [i for i, x in enumerate(a) if x == b[0]] 

if len(b) == 1:
    for i in range(n):
        print(b[0])
else:
    for i in range(n):
        if a[i] == b[0]: 
            print(b[1]) 
        else: 
            print(b[0]) 

Failing test case input:
3
3
-2
3

Expected output:
3
3
3


Actual output:
-2
3
-2


Fixed submission (verdict: Accepted):
import heapq

n = int(input())
a = [int(input()) for i in range(n)]
b = heapq.nlargest(2, set(a))
c = a.count(b[0])

if len(b) == 1 or c > 1: 
    for i in range(n):
        print(b[0]) 

else: 
    for i in range(n):
        if a[i] == b[0]: 
            print(b[1]) 
        else: 
            print(b[0])

Problem: p02971
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [int(input()) for i in range(n)]
m = max(a)

k = [i for i, x in enumerate(a) if x == m]

if len(k)>=2:
	for i in a:
		print(m)
else:
	b = []
	b += a
	mi = b.index(m)
	b.pop(mi) 
	print(a)
	m2 = max(b)
	for i in a:
		if i != m:
			print(m)
		else:
			print(m2)

Failing test case input:
3
1
0
3

Expected output:
3
3
1


Actual output:
[1, 0, 3]
3
3
1


Fixed submission (verdict: Accepted):
n = int(input())
a = [int(input()) for i in range(n)]
m = max(a)

k = [i for i, x in enumerate(a) if x == m]

if len(k)>=2:
	for i in a:
		print(m)
else:
	b = []
	b += a
	mi = b.index(m)
	b.pop(mi) 
	m2 = max(b)
	for i in a:
		if i != m:
			print(m)
		else:
			print(m2)
Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
a = []
for l in sys.stdin:
    a.append(l)


word_num = int(a[0])
word = a[1]
char_num = int(a[2])

target_char = word[char_num]

result = []
for each_char in word:
    if each_char != target_char:
        result.append('*')
    else:
        result.append(each_char)
result = ''.join(result)
print(result)


Failing test case input:
9
ntdoacujc
1

Expected output:
n********


Actual output:
*t********


Fixed submission (verdict: Accepted):
import sys
a = []
for l in sys.stdin:
    a.append(l)


word_num = int(a[0])
word = a[1].split()[0]
char_num = int(a[2])

target_char = word[char_num - 1]

result = []
for each_char in word:
    if each_char != target_char:
        result.append('*')
    else:
        result.append(each_char)
result = ''.join(result)
print(result)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()
S = input()
K = input()

char = S[int(K)-1]



ans = []

for j in range(len(S)):
  
  if char != S[j]:
    ans.append("*")
    
  else:
    ans.append(char)
    continue

print(" ".join(ans))



Failing test case input:
9
noisaeudb
7

Expected output:
******u**


Actual output:
* * * * * * u * *


Fixed submission (verdict: Accepted):
N = input()
S = input()
K = input()

char = S[int(K)-1]



ans = []

for j in range(len(S)):
  
  if char != S[j]:
    ans.append("*")
    
  else:
    ans.append(char)
    continue

print("".join(ans))

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
k = int(input())

letter = s[k-1]
out = ''

for i in range(n):
    print(s[i], letter)
    if s[i] == letter:
        out += s[i]
    else:
        out += '*'

print(out)

Failing test case input:
9
nmtbfiuca
6

Expected output:
*****i***


Actual output:
n i
m i
t i
b i
f i
i i
u i
c i
a i
*****i***


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
k = int(input())

letter = s[k-1]
out = ''

for i in range(n):
    if s[i] == letter:
        out += s[i]
    else:
        out += '*'

print(out)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
a = []
for l in sys.stdin:
    a.append(l)


word_num = int(a[0])
word = a[1]
char_num = int(a[2])

target_char = word[char_num - 1]

result = []
for each_char in word:
    if each_char != target_char:
        result.append('*')
    else:
        result.append(each_char)
result = ''.join(result)
print(result)


Failing test case input:
9
eb`bsvino
5

Expected output:
****s****


Actual output:
****s*****


Fixed submission (verdict: Accepted):
import sys
a = []
for l in sys.stdin:
    a.append(l)


word_num = int(a[0])
word = a[1].split()[0]
char_num = int(a[2])

target_char = word[char_num - 1]

result = []
for each_char in word:
    if each_char != target_char:
        result.append('*')
    else:
        result.append(each_char)
result = ''.join(result)
print(result)
Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
6
nfvele
1

Expected output:
n*****


Actual output:
n
n*****


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

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import sys
input = sys.stdin.readline

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

moji = S[K - 1]

for s in S:
    print("*" if s != moji else s, end="")

print()


Failing test case input:
9
ectb`vino
6

Expected output:
*****v***


Actual output:
*****v****


Fixed submission (verdict: Accepted):


import sys
input = sys.stdin.readline

N = int(input())
S = input()[:-1]
K = int(input())

moji = S[K - 1]

for s in S:
    print("*" if s != moji else s, end="")

print()

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = str(input())
K = int(input())
K_S = S[K - 1]
print(K_S)
for i in range(N):
    if S[i] != K_S:
        S = S.replace(S[i], '*')
print (S)

Failing test case input:
9
noitacude
2

Expected output:
*o*******


Actual output:
o
*o*******


Fixed submission (verdict: Accepted):
N = int(input())
S = str(input())
K = int(input())
K_S = S[K - 1]
for i in range(N):
    if S[i] != K_S:
        S = S.replace(S[i], '*')
print (S)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
S=list(input())
K=int(input())
moji=S[K-1]
for i in range(N):
  if S[i]!=moji:
    S[i]="*"
mojiretu=""
for x in S:
  mojiretu+=moji
print(mojiretu)
  

Failing test case input:
9
nnitaaude
6

Expected output:
****aa***


Actual output:
aaaaaaaaa


Fixed submission (verdict: Accepted):
N=int(input())
S=list(input())
K=int(input())
moji=S[K-1]


for i in range(N):
    
    if S[i]!=moji:
        S[i]="*"
mojiretu=""
for x in S:
  mojiretu+=x
print(mojiretu)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=input()
m=input()
l=int(input())
kotae=""
key=m[l-1]

for i in range(len(m)):
    if m[i] != key:
        kotae=kotae+"*"
    else:
        kotae=kotae+key
        

Failing test case input:
9
ditb`ndtn
3

Expected output:
**t****t*


Actual output:

Fixed submission (verdict: Accepted):
n=input()
m=input()
l=int(input())
kotae=""
key=m[l-1]

for i in range(len(m)):
    if m[i] != key:
        kotae=kotae+"*"
    else:
        kotae=kotae+key
print(kotae)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=list(input())
k=int(input())
for i in range(n):
    if s[i] != s[k-1]:
        s[i]=s[k-1]
print(''.join(s))


Failing test case input:
5
orrer
2

Expected output:
*rr*r


Actual output:
rrrrr


Fixed submission (verdict: Accepted):
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))
Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = list(input())
K = int(input())
tag = S[K - 1]
for i in range(N):
    if S[i] == tag:
        continue
    else:
        S[i] == "*"
print("".join(S))


Failing test case input:
9
noisaeudb
5

Expected output:
****a****


Actual output:
noisaeudb


Fixed submission (verdict: Accepted):
N = int(input())
S = list(input())
K = int(input())
tag = S[K - 1]
for i in range(N):
    if S[i] == tag:
        continue
    else:
        S[i] = "*"
print("".join(S))

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
k=int(input())
num = 0
for i in s:
  if i == s[k-1]:
    num +=1
  else:
    s = s.replace(s[num],'*')
    num +=1

Failing test case input:
9
acuifbtmn
6

Expected output:
*****b***


Actual output:

Fixed submission (verdict: Accepted):
n=int(input())
s=input()
k=int(input())
num = 0
for i in s:
  if i == s[k-1]:
    num +=1
  else:
    s = s.replace(s[num],'*')
    num +=1
print(s)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = input()
k = int(input()) -1
d = s[k]
w = []
for i in range(n-1):
    if s[i] != d:
        w.append('*')
    else:
        w.append(d)
print(*w, sep='')

Failing test case input:
5
error
2

Expected output:
*rr*r

Actual output:
*rr*


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
k = int(input()) -1
d = s[k]
w = []
for i in range(n):
    if s[i] != d:
        w.append('*')
    else:
        w.append(d)
print(*w, sep='')

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=input()
k=int(input())
S=list(s)
for i in range(n):
    if S[i]!=S[k-1]:
        S[i]='*'
ans=','.join(S)
print(ans)

Failing test case input:
6
nfvele
1

Expected output:
n*****


Actual output:
n,*,*,*,*,*


Fixed submission (verdict: Accepted):
n=int(input())
s=input()
k=int(input())
S=list(s)
for i in range(n):
    if S[i]!=S[k-1]:
        S[i]='*'
ans=''.join(S)
print(ans)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
K = int(input())
l = S[K - 1]
result = ""
print(l)
for s in S:
    if s != l:
         result += "*"
    else:
         result += s
print(result)

Failing test case input:
6
ekveen
3

Expected output:
**v***


Actual output:
v
**v***


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
K = int(input())
l = S[K - 1]
result = ""
for s in S:
    if s != l:
         result += "*"
    else:
         result += s
print(result)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = int(input())
word = list(input())
K = int(input())

judge=word[K-1]
for i in range(S):
    if word[i] == judge:
        pass
    else:
        word[i] = '*'
print(" ".join(word))

Failing test case input:
9
bdueasion
6

Expected output:
*****s***


Actual output:
* * * * * s * * *


Fixed submission (verdict: Accepted):
S = int(input())
word = list(input())
K = int(input())

judge=word[K-1]
for i in range(S):
    if word[i] != judge:
        word[i] = '*'
print("".join(word))
Problem: p03068
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
s = input()
k = int(input())

sk = s[k-1]
print(sk)

new_s = ""
for cal in s:
  if cal != sk:
    new_s += "*"
  else:
    new_s += sk
print(new_s)

Failing test case input:
6
neevke
6

Expected output:
*ee**e


Actual output:
e
*ee**e


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
k = int(input())

sk = s[k-1]

new_s = ""
for cal in s:
  if cal != sk:
    new_s += "*"
  else:
    new_s += sk
print(new_s)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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] = "*"
print(S)

Failing test case input:
9
nmjtaaude
2

Expected output:
*m*******


Actual output:
* m * * * * * * *

Fixed submission (verdict: Accepted):
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] = "*"
i=0
for i in range(N):
    print(S[i], end="")

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = list(input())
K = int(input())
K = S[K-1]
    
for i in range(N):
    if S[i] != K:
        S[i] = "*"
        
print(S)

Failing test case input:
9
eb`bsvino
5

Expected output:
****s****


Actual output:
* * * * s * * * *

Fixed submission (verdict: Accepted):
N = int(input())
S = input()
K = int(input())
K = S[K-1]
S = list(S)

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

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

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = str(input())
K = int(input())

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


print(x)
print(T)


Failing test case input:
6
nfvele
1

Expected output:
n*****


Actual output:
n
n*****


Fixed submission (verdict: Accepted):
N = int(input())
S = str(input())
K = int(input())

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

print(T)

Problem: p03068
Buggy submission (Python (2.7.6), verdict: Wrong Answer):
import sys


def main():
    N = int(sys.stdin.readline())
    S = sys.stdin.readline()
    K = int(sys.stdin.readline())
    s = S[K-1]
    result = ""
    for i in list(S):
        if i == s:
            result = result + i
        else:
            result = result + "*"
    print(result)


if __name__ == "__main__":
    main()


Failing test case input:
5
serro
1

Expected output:
s****


Actual output:
s*****


Fixed submission (verdict: Accepted):
import sys


def main():
    N = int(sys.stdin.readline())
    S = sys.stdin.readline().strip()
    K = int(sys.stdin.readline())
    s = S[K-1]
    result = ""
    for i in list(S):
        if i == s:
            result = result + i
        else:
            result = result + "*"
    print(result)


if __name__ == "__main__":
    main()
Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = list(input())
K = int(input())

ok_str = S[K-1]
print(ok_str)

for i in range(N):
    if S[i] == ok_str:
        pass
    else:
        S[i] = '*' 

print(''.join(S))

Failing test case input:
6
ekeven
5

Expected output:
e*e*e*


Actual output:
e
e*e*e*


Fixed submission (verdict: Accepted):
N = int(input())
S = list(input())
K = int(input())

ok_str = S[K-1]

for i in range(N):
    if S[i] == ok_str:
        pass
    else:
        S[i] = '*' 

print(''.join(S))

Problem: p03068
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
S = input()
s = S[int(input())-1]

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

Failing test case input:
9
ncdoacujt
2

Expected output:
*c***c***


Actual output:
c


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
s = S[int(input())-1]

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

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = input()
K = int(input())
str = S[K-1]
for i in range(N):
    if S[i] != str:
        S=S.replace(S[i],'＊')
print(S)


Failing test case input:
6
nkveee
4

Expected output:
***eee


Actual output:
＊＊＊eee


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
K = int(input())
str = S[K-1]
for i in range(N):
    if S[i] != str:
        S=S.replace(S[i],'*')
print(S)

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = list(input())
k = int(input())
c = s[k-1]
for i in range(n):
  if not s[i] == c:
    s[i] = c
print("".join(s))

Failing test case input:
9
ectb`vino
9

Expected output:
********o


Actual output:
ooooooooo


Fixed submission (verdict: Accepted):
n = int(input())
s = list(input())
k = int(input())
c = s[k-1]
for i in range(n):
  if not s[i] == c:
    s[i] = '*'
print("".join(s))

Problem: p03068
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
string = input()
k = int(input())

key = string[k-1]

index_list = [i for i,letter in enumerate(string) if letter == key]

word = ["*" for i in range(len(string))]
for elem in index_list:
	print(elem)
	word[elem] = key

word = "".join(word)
print(word)

Failing test case input:
9
eiubatcnn
7

Expected output:
******c**


Actual output:
6
******c**


Fixed submission (verdict: Accepted):
n = int(input())
string = input()
k = int(input())

key = string[k-1]

index_list = [i for i,letter in enumerate(string) if letter == key]

word = ["*" for i in range(len(string))]
for elem in index_list:
	word[elem] = key

word = "".join(word)
print(word)