Word Count

You are given a grid consisting of letters & a string. Your task is to find all occurrences of a giv…

Click here to read the complete problem statement.


If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

new=‘’
while True:
try:
var=input()
new=new+’ ‘+var
except:
break
array=new.split(’ ')
replica=list(set(array))
number=list(map(lambda x:array.count(x),replica))
print(replica[number.index(max(number))])

why is this code wrong? i have run it through custom input and the output exactly matches the sample output, but it shows wrong answer for sample test cases.

sorry i don’t know python pl.

you can try this one in c++:
firstly, Input Every word in a vector and then sort them.
secondly, count the maximum similar world and store its index.
finally, print that word.
“Happy Coding”