#C8. Highest Priority Language
Highest Priority Language
Highest Priority Language
Given a number of test cases, each containing a sentence of lowercase English words representing programming languages, determine the language that appears with the highest frequency. If there is a tie, choose the language whose first letter has the highest priority. The priority is defined by the formula: \(priority = \text{ord}(language[0]) - \text{ord}('a') + 1\), meaning that a language starting with 'a' has the highest priority and one starting with 'z' has the lowest.
If the sentence is empty, output no_language
.
Example:
Input: 3 python java python ruby cpp python java javascript cpp go rust go go</p>Output: python cpp go
inputFormat
The input is given through standard input (stdin). The first line contains an integer \(T\) representing the number of test cases. This is followed by \(T\) lines, each representing a sentence consisting of lowercase English words separated by spaces.
outputFormat
For each test case, output the language that has the highest frequency. In the case of a tie, output the one with the highest priority (i.e. the one whose first letter is alphabetically smallest). Each answer should be printed on a new line on standard output (stdout). If no language is present in a test case, print no_language
.
1
python java python ruby
python
</p>