title: found a string with strstr() inside a txt
body: <p>I want to make a code in c for searching how many times a string is found inside a txt file using strstr() function.</p>
  
  <p>I have made a test code with strastr() but I have a problem.</p>
  
  <p>e.g I have sentence like <code>" this is a text"</code> and when I search for <code>"is"</code> I get a result <code>"is found 2 times"</code> because it takes the "is" from "this". I don't want to take the <code>is</code> from <code>this</code> i want "is" as only word. Can i search without this "problem" with strstr() with some changes</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include&lt;string.h&gt;
  int main()
  {
      char*ptr;
      char input[]=("this is a text");
      char key[10];
      int counter;
      scanf("%s",key);
      ptr=strstr(input,key);
      while (ptr==NULL)
      {
          printf("not found\n");
          break;
      }
      while(ptr!=NULL)
      {
          counter++;
          ptr=strstr(ptr+1,key);
      }
      printf("%s found %d times\n",key,counter);
      return 0;
  }
  </code></pre>