Untitled
unknown
python
2 years ago
578 B
10
Indexable
import sys
n = int(input())
str = input()
x = input()
freq = {}
for char in str:
if char in freq:
freq[char] += 1
else:
freq[char] = 1
max_freq = 0
max_char = ''
for char, f in freq.items():
if f > max_freq:
max_freq = f
max_char = char
elif f == max_freq and ord(char) < ord(max_char):
max_char = char
result = ''
for char in str:
if char == max_char:
result += x
else:
result += char
print(result if len(result) > 0 else "NULL")Editor is loading...
Leave a Comment