title: Replacing a word in a text by another given word
body: <p>I have this code here</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include&lt;conio.h&gt;
  
  void main()
  {
    char s[] = "All work and no play makes Jack a dull boy.";
    char word[10],rpwrd[10],str[10][10];
    int i=0,j=0,k=0,w,p;
  
    printf("All work and no play makes Jack a dull boy.\n");
    printf("\nENTER WHICH WORD IS TO BE REPLACED\n");
    scanf("%s",word);
    printf("\nENTER BY WHICH WORD THE %s IS TO BE REPLACED\n",word);
    scanf("%s",rpwrd);
    p=strlen(s);
  
    for (k=0; k&lt;p; k++)
      {
        if (s[k]!=' ')
          {
            str[i][j] = s[k];
            j++;
          }
        else
          {
            str[i][j]='\0';
            j=0; i++;
          }
      }
  
    str[i][j]='\0';
    w=i;
  
    for (i=0; i&lt;=w; i++)
      {
        if(strcmp(str[i],word)==0)
          strcpy(str[i],rpwrd);
  
        printf("%s ",str[i]);
      }
    getch();
  }
  </code></pre>
  
  <p>How can I replace the word just 'Jack'? like</p>
  
  <p>Output:</p>
  
  <pre><code>All work and no play makes Jack a dull boy.
  
  Enter ther word Jack to be Replaced
  Mark
  Tom
  
  All work and no play makes Mark a dull boy.
  All work and no play makes Tom a dull boy.
  </code></pre>
  
  <p>without search the whole Sentence.</p>
  
  <p>thx</p>