C Interview Questions tutorial #26- How to Remove All Duplicates Characters From String || Codenemy

preview_player
Показать описание
Hey Guys,
In this C Interview Questions tutorial, this video is about How to remove all duplicates characters from given string.

GitHub URL of program :
Рекомендации по теме
Комментарии
Автор

thanks bro, this is exactly what I was looking for

aldodamara
Автор

My input is "java" and i want the output like "jv" remove the repeate charater alongwith repeadted character. Can you upload the

thippeshrangappagari
Автор

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char str[50];
char del_char;
int i, j, len;
printf("Enter string\n");
gets(str);
printf("Enter a character\n");
del_char=getchar();
len=strlen(str);
for(i=0;i<len;i++)
{
if(str[i]==del_char)
{
for(j=i;j<len;j++)
{
str[j]=str[j+1];
}
len--;
i--;
}
}

printf("New string:%s\n", str);
return 0;
}

input:welcomeee
output:wlcom

prathibhap