First line
cin >> the_string;
doesn't get the whole line. Use this instead
getline(cin, the_string);
Secondly, when debugging your algorithm, print a lot of information. For example, if you add a line
cout << "You entered: '" << the_string << "'" << endl;
you can easily see which line you are actually checking.
user1623994
source share