#include <stdio.h>
#include <stdint.h>
void remove_duplicates(char *str) {
char strcp[100];
int count=0,f=0,n=0;
while(1){
if(*(str+n)=='\0'){
*(strcp+count)=*(str+n);
for(int i=0;i<=count;i++){
*(str+i)=strcp[i];
}
break;
}
else{
f=0;
for(int i=0;i<count;i++){
if(*(str+n)==*(strcp+i)){
f=1;
break;
}
}
if(f==0){
*(strcp+count)=*(str+n);
count++;
}
}
n++;
}
//Your logic here
}
int main() {
char str[101];
fgets(str, sizeof(str), stdin);
// Remove newline
uint8_t i = 0;
while (str[i]) {
if (str[i] == '\n') {
str[i] = '\0';
break;
}
i++;
}
remove_duplicates(str);
printf("%s", str);
return 0;
}
Input
programming
Expected Output
progamin