title: How to get the total count of palindrome words found in a sentence
body: <p>I am working on a program which accepts a long string as input (a sentence). The program will check the string and count the number of palindrome words found then return the count.</p>
  <p>Example:</p>
  <p><strong>input</strong>:</p>
  <pre><code>_gig school level bye_
  </code></pre>
  <p><strong>output</strong>:</p>
  <pre><code>_2._
  </code></pre>
  <p>How can I get the total count of palindrome words in a sentence?</p>
  <p>Below is what I have coded so far.</p>
  <pre><code>/*
  My basic idea is: 
  1) I will retrieve words from a sentence using &quot;if(s[i] == ' ')&quot;
  2) I will check if the word is a palindrome
  3) If it is a palindrome, I will add the word to the count &quot;count++&quot;
  */
  
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  int main()
  {
     char s[80],temp;
     int i,j, len, count;
     count = 0;
  
     gets(s);
     len=strlen(s);
     j = len - 1;
  
     for(i = 0; i &lt; len; i++){
     if(s[i] == ' '){
          for(;i&lt;j;i++,j--)
          {   
              if(s[i] != s[j])
              break;  
          }
          if(i&gt;=j)
          {
              count++;
          }
      }
      if (i == len)
          break;
  }
  
  printf(&quot;%d&quot;, count);
  return 0;
  }
  </code></pre>