DEV Community

Discussion on: Solving a Job Application Code Challenge

Collapse
 
magmax profile image
Miguel Ángel García

My solution. In python.

from collections import Counter

with open('test.input') as fd:  # the string is in the "test.input" file
    c = Counter(fd.read())

string = ''.join(sorted(c.keys(), key=lambda x: -1 * c[x]))
print(string[:string.index('_')])