Проблем при решаване на задача "Email Statistics"
Зравейте,
решението https://pastebin.com/QRjR6AwL - не минава втори нулев тест, както и останалите тестове. Помощ за уставяване на правилното решение??
Условие:
You will receive n emails from the console. Some of these emails will be invalid. In order one email to be valid it should pass the following conditions:
- The username of the user should be at least 5 characters long and consist only of uppercase and lowercase Latin letters.
- The username should be followed immediately by ‘@’.
- The domain part should consist of two parts:
- The mail server, which should contain only lowercase Latin letters and should be at least 3 letters long.
- The top-level domain, which can be one of the following: .com, .bg or .org
At the end, print data in the format described in the output section.
Input
- On the first line, you will receive n – the count of emails.
- On the next n lines, you will receive emails.
Output
Print the domains in the format:
{1st domain}: ### {1st username} ### {2nd username} … ### {nth username} … {nth domain} ### {1st username} … ### {nth username} |
Order the domains by the counts of usernames in the domain in descending order. If they are equal, print them in the order, in which they were received.
Order the usernames by the time of receiving.
If you receive two of the same username for one domain – ignore it.
Examples
Input |
Output |
5 Pesho@abv.bg JohnDowe@gmail.com Maria@gmail.com invalid123@dir.bg nakov@yahoo.com |
gmail.com: ### JohnDowe ### Maria abv.bg: ### Pesho yahoo.com: ### nakov |
Input |
Output |
5 Georgi@abv.bg Petran@gmail.com Vladi@gmail.com super_man@abv.bg superMan@abv.bg |
abv.bg: ### Georgi ### superMan gmail.com: ### Petran ### Vladi |