Remove all duplicate characters in a string

C program to remove all duplicate characters in a string.

Program

#include<stdio.h>
#include<conio.h>
#include<string.h>
#define MAX 50

void main()
{
	char str[MAX];
    int i, j, k, len;

    printf("Enter the string\t:");
    gets(str);

    len = strlen(str);

    for(i=0;i<len;i++)
    {
        for(j=i+1;j<len;j++)
        {
            if(str[i] == str[j])
            {
                for(k=j;k<len;k++)
                {
                    str[k] = str[k+1];
                }
                len--;
            }
        }
    }

    str[len] = '\0';

    printf("\nModified string\t:%s",str);

    getch();
}

Output

Enter the string        :welcome to coursecrux.com

Modified string :welcom tursx.