I don't know if my question is repeated or not since I couldn't really find the right answer. I wanted to print the most frequent words or numbers on a new line. However, if the frequency are the same then print both words/numbers.
Input: green green green orange orange yellow
Output: green
Input: green green green orange orange orange yellow
Output: green
orange
Input: 1 1 2 2 3 3 4
Output: 1
2
3
Input: 1 1 1 2 2 3 3
Output: 1