title: Moving repeated characters in string to the end
body: <p>I tried to move the repeated characters in a string to its end positions but my code not working for more than two repeated characters. I tried to solve it but not getting it.
  Here is my code</p>
  
  <pre><code>main () {
  char string[100];
  char *s, *p;
  char c;
  scanf("%s", string);
  s = string;
  c = *s++;
  while (*s){
      if(*s == c){
          for(p = s; *p ; p++)
              *p = *(p + 1);
          *--p = c;
      }
      c = *s;
      s++;
  }
  printf ( "%s\n", string);
  }
  </code></pre>