//#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <vector>
#include <utility>
typedef std::pair<std::string,std::string> attribute_pair;
typedef std::vector<attribute_pair> attribute_vector;
typedef std::map<std::string,attribute_vector> bird_map;
int main()
{
//std::ifstream file("Bird.lst");
std::istream &file = std::cin;
bird_map birds;
std::string key;
while(std::getline(file,key))
{
// in case it has windows encoding with end-of-line = \r\n
if (!key.empty() &&
key[key.size()-1] == '\r')
{
key.erase(key.size() - 1);
}
if (key.empty()) continue;
attribute_vector attributes;
std::string value;
while(std::getline(file,value))
{
// in case it has windows encoding with end-of-line = \r\n
if (!value.empty() &&
value[value.size()-1] == '\r')
{
value.erase(value.size() - 1);
}
// if we found the empty string
if(value.empty())
{
break;
}
// now split the value into an attribute and a flag
attribute_pair attribute;
std::istringstream ss(value);
ss >> attribute.first >> attribute.second;
if(attribute.first != "vaccinated" && attribute.first != "babies" && attribute.first != "sale") {
// save the value into the vector
attributes.push_back(attribute);
}
}
// save the bird into the map
birds[key] = attributes;
}
// now print the data we collected
for(bird_map::iterator bird = birds.begin();
bird != birds.end();
bird++)
{
std::cout << bird->first << "\n";
for(attribute_vector::iterator attribute = bird->second.begin();
attribute != bird->second.end();
attribute++)
{
std::cout << " " << attribute->first
<< " " << attribute->second
<< "\n";
}
std::cout << "\n";
}
return 0;
}