shop.example.net. Its parent domains come from dropping parts on the left: example.net, and then net. A one-part domain has no parents. A visit to a domain also counts as a visit to each of its parents.
You are given a log log where each entry looks like "<count> <domain>": a visit count, a space and the domain. For example, "300 shop.example.net" means 300 visits to shop.example.net.
Return a summary in the same "<count> <domain>" format: one line for every domain that appears in the log, either directly or as a parent, with its total number of visits. The lines may come in any order.log=['40 shop.example.net'] → ['40 shop.example.net', '40 example.net', '40 net']
40 visits to shop.example.net are also 40 visits to example.net and 40 to net.
log=['5 api.cloud.io', '7 docs.cloud.io', '2 news.ru'] → ['5 api.cloud.io', '12 cloud.io', '12 io', '7 docs.cloud.io', '2 news.ru', '2 ru']
cloud.io and io collect 5 + 7 = 12 visits, news.ru and ru get 2 each, and api.cloud.io and docs.cloud.io keep their own 5 and 7.
log=['40 shop.example.net']
['40 shop.example.net', '40 example.net', '40 net']
Run checks the first 3 tests in your browser. Submit checks all 69 tests on the server, hidden ones included.