#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+ICAKI2luY2x1ZGU8bWFwPiAgCiNpbmNsdWRlPHN0cmluZz4KI2luY2x1ZGU8dXRpbGl0eT4gCgp1c2luZyBuYW1lc3BhY2Ugc3RkOyAKCmludCBtYWluKCkgeyAgCiAgICB0eXBlZGVmIG1hcDxzdHJpbmcsIGludD4gbWFwVHlwZTsgIAogICAgbWFwVHlwZSBwb3B1bGF0aW9uTWFwOyAgCgogICAgcG9wdWxhdGlvbk1hcC5pbnNlcnQocGFpcjxzdHJpbmcsIGludD4oIk1haGFyYXNodHJhIiwgNzAyNjM1NykpOyAgCiAgICBwb3B1bGF0aW9uTWFwLmluc2VydChwYWlyPHN0cmluZywgaW50PigiUmFqYXN0aGFuIiwgNjU3ODkzNikpOyAKICAgIHBvcHVsYXRpb25NYXAuaW5zZXJ0KHBhaXI8c3RyaW5nLCBpbnQ+KCJLYXJuYXRha2EiLCA2Njc4OTkzKSk7CiAgICBwb3B1bGF0aW9uTWFwLmluc2VydChwYWlyPHN0cmluZywgaW50PigiUHVuamFiIiwgNTc4OTAzMikpOyAKICAgIHBvcHVsYXRpb25NYXAuaW5zZXJ0KHBhaXI8c3RyaW5nLCBpbnQ+KCJXZXN0IEJlbmdhbCI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