Another map find() int main() { map count; string s; while (cin >> s) count[s]++; if (count.find("hello") != count.end()) cout << "You said hello"; else cout << "You never said hello"; }