//#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <string>
#include <utility>
typedef std::map<std::string,std::string> attribute_map;
typedef std::map<std::string,attribute_map> 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_map 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
std::string attr_name, attr_value;
std::istringstream ss(value);
ss >> attr_name >> attr_value;
if(attr_name != "vaccinated" && attr_name != "babies" && attr_name != "sale") {
// save the value into the vector
attributes[attr_name] = attr_value;
}
}
// 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_map::iterator attribute = bird->second.begin();
attribute != bird->second.end();
attribute++)
{
std::cout << " " << attribute->first
<< " " << attribute->second
<< "\n";
}
std::cout << "\n";
}
return 0;
}