#include<iostream>
#include<map>
#include<string>
#include<utility>
using namespace std;
int main() {
typedef map<string, int> mapType;
mapType populationMap;
populationMap.insert(pair<string, int>("Maharashtra", 7026357));
populationMap.insert(pair<string, int>("Rajasthan", 6578936));
populationMap.insert(pair<string, int>("Karnataka", 6678993));
populationMap.insert(pair<string, int>("Punjab", 5789032));
populationMap.insert(pair<string, int>("West Bengal", 6676291));
mapType::iterator iter;
cout << "====Population of states in India====";
cout << "\nSize of populationMap: " << populationMap.size() << "\n";
string state_name;
cout << "\nEnter name of the state: ";
cin >> state_name;
iter = populationMap.find(state_name);
if (iter != populationMap.end()) {
cout << state_name << "'s population is " << iter->second << "\n";
} else {
cout << "Key is not in populationMap\n";
}
populationMap.clear();
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+ICAKI2luY2x1ZGU8bWFwPiAgCiNpbmNsdWRlPHN0cmluZz4KI2luY2x1ZGU8dXRpbGl0eT4gCiAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsgCiAKaW50IG1haW4oKSB7ICAKICAgIHR5cGVkZWYgbWFwPHN0cmluZywgaW50PiBtYXBUeXBlOyAgCiAgICBtYXBUeXBlIHBvcHVsYXRpb25NYXA7ICAKIAogICAgcG9wdWxhdGlvbk1hcC5pbnNlcnQocGFpcjxzdHJpbmcsIGludD4oIk1haGFyYXNodHJhIiwgNzAyNjM1NykpOyAgCiAgICBwb3B1bGF0aW9uTWFwLmluc2VydChwYWlyPHN0cmluZywgaW50PigiUmFqYXN0aGFuIiwgNjU3ODkzNikpOyAKICAgIHBvcHVsYXRpb25NYXAuaW5zZXJ0KHBhaXI8c3RyaW5nLCBpbnQ+KCJLYXJuYXRha2EiLCA2Njc4OTkzKSk7CiAgICBwb3B1bGF0aW9uTWFwLmluc2VydChwYWlyPHN0cmluZywgaW50PigiUHVuamFiIiwgNTc4OTAzMikpOyAKICAgIHBvcHVsYXRpb25NYXAuaW5zZXJ0KHBhaXI8c3RyaW5nLCBpbnQ+KCJXZXN0IEJlbm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