#include <iostream>
#include <string>
#include <map>
int main()
{
std::map<std::string, int> dictionary;
std::string input;
while(std::cin >> input && input != "**END**")
++dictionary[input];
for(const auto& e: dictionary)
if(e.second > 1)
std::cout << e.first << ' ' << e.second << '\n';
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8bWFwPgoKaW50IG1haW4oKQp7CiAgICBzdGQ6Om1hcDxzdGQ6OnN0cmluZywgaW50PiBkaWN0aW9uYXJ5OwogICAgc3RkOjpzdHJpbmcgaW5wdXQ7CiAgICB3aGlsZShzdGQ6OmNpbiA+PiBpbnB1dCAmJiBpbnB1dCAhPSAiKipFTkQqKiIpCiAgICAgICAgKytkaWN0aW9uYXJ5W2lucHV0XTsKICAgIGZvcihjb25zdCBhdXRvJiBlOiBkaWN0aW9uYXJ5KQogICAgICAgIGlmKGUuc2Vjb25kID4gMSkKICAgICAgICAgICAgc3RkOjpjb3V0IDw8IGUuZmlyc3QgPDwgJyAnIDw8IGUuc2Vjb25kIDw8ICdcbic7Cn0K