fork download
  1. #include <stdio.h>
  2. #include<string.h>
  3.  
  4. void RemoveDuplicates(char* str)
  5. {
  6. int a = 0,j,i = 0,k;
  7. while(str[a] != '\0')
  8. a++;
  9. while(str[i] != '\0')
  10. {
  11. j = i+1;
  12. while(str[j] != '\0')
  13. {
  14. if(str[i] == str[j])
  15. {
  16. k = j
  17. while(str[k] != '\0')
  18. {
  19. str[k] = str[k+1];
  20. k++;
  21. }
  22. a--;
  23. }
  24. else
  25. j++;
  26. }
  27. printf("%s",str);
  28. }
  29. int main() {
  30. //code
  31. int a;
  32. scanf("%d",&a);
  33. for(int i = 0;i<a;i++)
  34. {
  35. char str[i][50];
  36. scanf("%s",str[i]);
  37. RemoveDuplicates(str);
  38. }
  39. return 0;
  40. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
2
geeksforgeek
acaaabbbacdddd
compilation info
prog.c: In function 'RemoveDuplicates':
prog.c:17:11: error: expected ';' before 'while'
           while(str[k] != '\0')
           ^
prog.c:29:5: warning: 'main' is normally a non-static function [-Wmain]
 int main() {
     ^
prog.c: In function 'main':
prog.c:37:23: warning: passing argument 1 of 'RemoveDuplicates' from incompatible pointer type [-Wincompatible-pointer-types]
      RemoveDuplicates(str);
                       ^
prog.c:4:6: note: expected 'char *' but argument is of type 'char (*)[50]'
 void RemoveDuplicates(char* str)
      ^
prog.c: In function 'RemoveDuplicates':
prog.c:40:1: error: expected declaration or statement at end of input
 }
 ^
prog.c:6:23: warning: variable 'k' set but not used [-Wunused-but-set-variable]
     int a = 0,j,i = 0,k;
                       ^
stdout
Standard output is empty