More distinct letters
you are given a list of strings, write a program to print the string with the maximum number of distinct letters. If there are more than one such strings, print the string which comes first in alphabetical order. Note: consider upper and lower case letters are different.
Input: The input is a single line containing the strings separated by a space.
Output: The output should be a single line containing the string with maximum distinct characters.
Explanation:
In the example, the given list of strings are raju , plays , golf. The word plays has the maximum number of distinct letters. So the output should be plays.
lst = input().split()
llst = [len(set(x)) for x in lst]
print(lst[llst.index(max(llst))])
Comments
Leave a comment