#include <string.h> #include <stdio.h> #include <stdlib.h> #define N 20 int main(){ char M[N], M2[N]; int i,j; gets(M); for(i=0; M2[i] !='\0';i++){ M2[i]=' '; } M2[0]=M[0]; for (i=0; M[i] != '\0'; i++){ char n = M[i]; for (j=0; j=i; j++){ if (n!=M[j]){ M2[j]=n; }else{ for(int u=j;M[u]!='\0';u++){ M[u]=M[u+1]; } } } } for (i=0; M2[i] != '\0';i++) { printf ("%c", M2[i]); } } When I run the code, the compiler loops. According to the task you need to rewrite the string without duplicate characters.