Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Utshaw/669ce8cc4ef78ea16638628a074a15b7 to your computer and use it in GitHub Desktop.
Save Utshaw/669ce8cc4ef78ea16638628a074a15b7 to your computer and use it in GitHub Desktop.
check for a key and insert if not exists
map<char, int> :: iterator iter = charFrequency.find(a);
if(iter == charFrequency.end() ){ // not found
charFrequency.insert({a, 1});
}else{ // found
iter->second = iter->second + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment