Dominant Initial | Techgig | Passed all test cases
Автор: codeflu
Загружено: 2022-05-03
Просмотров: 557
Описание:
Subscribe & Like
full code link - https://www.codeflu.com/post/Competit...
Github - https://github.com/code-flu
Rom and Com were discussing about the dominance in the corporate world. Rom got an idea of finding the most dominant initial(alphabet) in their network. They planned to write the first initial alphabet of the persons in their network and figure out which one is the most dominant.
The initial alphabet which is present maximum is termed as the most dominant initial alphabet. If there are two or more initials which are dominant than the one with lesser ASCII value will be considered the dominant.
Rom and Com have made the whole string of the initials in their network and now needs your help in determining the dominant initial. Can you help them?
Note: The string of initials consists of only lowercase alphabets(a-z).
Input Format
The first line of input consists of the number of test cases, T.
Next T lines each consists of a string representing the initial alphabets of the people in their network.
Constraints
1 lessthan= T lessthan=10
1 lessthan= |string| lessthan=100000
Output Format
For each test case, print the dominant initial alphabet in a separate line.
Sample TestCase 1
Input
2
gqtrawq
fnaxtyyzz
Output
q
y
Explanation
Test Case 1: There are 2 q which makes them the most dominant.
Test Case 2: There are 2 y and 2 z. Since the maximum value is the same, the initial with lesser Ascii value is considered as output. Therefore, y is the dominant initial.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: