Write a program that reads a text (in the UTF-8) from the standard input. The program must count the frequency of words in the text and print the 10 most frequent words.
A word is a sequence of characters consisting only of digits and letters. For example, the string "Functions bring happiness!" has three words: "Functions", "bring", "happiness".
The counting words should be case-insensitive, i.e. "Functions", "functions" and "FUNCTIONS" are the same word. Output words in the lower case.
If the text has less than 10 unique words, output as many as there are.
If some words in the text have the same frequency, sort them according to the lexicographical order.
The problem has a beautiful solution using streams without any loops and conditional operators. Try to write it.