title: When I enter the word "ma'am", the program doesn't count it as a palindrome
body: <p>I have here a program that outputs the number of palindromes in a sentence. Case insensitive and ignores comma and periods when for instance the palindrome happens to be the last word in a sentence.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  char toUpper(char c) {
      if (c &gt;= 'a' &amp;&amp; c &lt;= 'z')
          return c - 'a' + 'A';
      else
          return c;
  }
  
  char isLetter(char c) {
      return (toUpper(c) &gt;= 'A' &amp;&amp; toUpper(c) &lt;= 'Z');
  }
  
  int findNextLetter(string&amp; s, int start) {
      // find first letter at or after 'start'
      for (int i = start; i &lt; s.length(); ++i) {
          if (isLetter(s[i])) return i;
      }
      return s.length();
  }
  
  int findNextPunct(string&amp; s, int start) {
      // find first non-letter character at or after 'start'
      for (int i = start; i &lt; s.length(); ++i) {
          if (!isLetter(s[i])) return i;
      }
      return s.length();
  }
  
  bool isPalindrome (const string&amp; s, int start, int stop) {
      // look for palindrome in the range (start) to (stop - 1)
      for (int i = 0; i &lt; (stop-start)/2; ++i) {
          if (toUpper(s[start + i]) != toUpper(s[stop - 1 - i])) {
              return false;
          }
      }
      return true;
  }
  
  int main() {
      string line;
      int counter=0;
      cout &lt;&lt; "Please input a sentence." &lt;&lt; endl;
      getline(cin, line);
      int wordStart = findNextLetter(line, 0);
      int wordEnd = findNextPunct(line, wordStart);
      while (wordStart != line.length()) {
          if (isPalindrome(line, wordStart, wordEnd))
              ++counter;
          wordStart = findNextLetter(line, wordEnd); // find start of next word
          wordEnd = findNextPunct(line, wordStart); // find end of next word
      }
      cout &lt;&lt; "Number of Palindromes: " &lt;&lt; counter &lt;&lt; endl;
  }
  </code></pre>
  
  <p>The program runs properly except when there is a word "ma'am". For example, when "Hello, ma'am! I'm Aya." is entered, the program just outputs 1, which means one palindrome: Aya. "ma'am" was not included because of the apostrophe.</p>
  
  <p>I will be so happy if you show me a concrete code so it will be easy for me to figure out what to change. But still, I thank you for any kinds of help. :)</p>