title: how do i remove the similar word in strings?
body: <p>I have program to remove the similar words from string but this program only removing at once word not a repeating words.</p>
  <p>For example input:</p>
  <pre><code>sabunkerasmaskera kera
  </code></pre>
  <p>and should an output:</p>
  <pre><code>sabunmas
  </code></pre>
  <p>This my code:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  void remove(char x[100], char y[100][100], char words[100]) {
      int i = 0, j = 0, k = 0;
      for (i = 0; x[i] != '\0'; i++) {
          if (x[i] == ' ') {
              y[k][j] = '\0';
              k++;
              j = 0;
          } else {
              y[k][j] = x[i];
              j++;
          }
      }
      y[k][j] = '\0';
   
      j = 0;
      for (i = 0; i &lt; k + 1; i++) {
          if (strcmp(y[i], kata) == 0) {
              y[i][j] = '\0';
          }
      }
   
      j = 0;
      
      for (i = 0; i &lt; k + 1; i++) {
          if (y[i][j] == '\0')
              continue;
          else
              printf(&quot;%s &quot;, y[i]);
      }
      printf (&quot;\n&quot;);
  }
  
  int main() {
      char x[100], y[100][100], kata[100];
      printf (&quot;Enter word:\n&quot;);
      gets(x);
   
      printf(&quot;Enter word to remove:\n&quot;);
      gets(words);
      
      remove(x, y, words);
      
      return 0;
  }
  </code></pre>
  <p>My program output its:</p>
  <pre><code>sabunkerasmaskerara
  </code></pre>
  <p>and that should not be the case. Maybe I need your opinion to fixed this program and also I need help to make it better.</p>