#include <bits/stdc++.h>
using namespace std;
int main() {
map<string, int> mpp;
mpp["raj"] = 27;
mpp["hima"] = 31;
mpp["praveer"] = 31;
mpp.insert({"raj", 45});
mpp.erase("raj"); // mpp.erase(key)
mpp.erase(mpp.begin()); // mpp.erase(iterator)
mpp.clear(); // entire map is cleaned up
auto it = mpp.find("raj"); // points to where raj lies
auto it2 = mpp.find("simran"); // points to end since she does not exists
if(mpp.find("raj") == mpp.end()) {
cout << "raj not present";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCW1hcDxzdHJpbmcsIGludD4gbXBwOyAKCW1wcFsicmFqIl0gPSAyNzsgCgltcHBbImhpbWEiXSA9IDMxOyAKCW1wcFsicHJhdmVlciJdID0gMzE7CgltcHAuaW5zZXJ0KHsicmFqIiwgNDV9KTsgCgkKCW1wcC5lcmFzZSgicmFqIik7IC8vIG1wcC5lcmFzZShrZXkpIAoJbXBwLmVyYXNlKG1wcC5iZWdpbigpKTsgLy8gbXBwLmVyYXNlKGl0ZXJhdG9yKQoJbXBwLmNsZWFyKCk7IC8vIGVudGlyZSBtYXAgaXMgY2xlYW5lZCB1cAoJCglhdXRvIGl0ID0gbXBwLmZpbmQoInJhaiIpOyAvLyBwb2ludHMgdG8gd2hlcmUgcmFqIGxpZXMgCglhdXRvIGl0MiA9IG1wcC5maW5kKCJzaW1yYW4iKTsgLy8gcG9pbnRzIHRvIGVuZCBzaW5jZSBzaGUgZG9lcyBub3QgZXhpc3RzIAogCglpZihtcHAuZmluZCgicmFqIikgPT0gbXBwLmVuZCgpKSB7CgkJY291dCA8PCAicmFqIG5vdCBwcmVzZW50IjsgCgl9CgkKCXJldHVybiAwOwp9Cg==