c program to compare two strings and remove the common letters

Program:

#include <stdio.h>
int main()
{
    char str1[100],str2[100];
    scanf("%s %s",str1,str2);
    int i,j;
    for(i=0;i<strlen(str2);i++)
    {
        for(j=0;j<strlen(str1);j++)
        {
            if(str2[i]==str1[j])
            {
                str1[j]='*';
            }
        }
    }
    for(i=0;i<strlen(str1);i++)
    {
        if(str1[i]!='*')
        {
            printf("%c",str1[i]);
        }
    }
return 0;    
}

output:


improvisation                                                                                                                                  
ipm                                                                                                                                            
rovsaton                                                                                                                                       
            


experience                                                                                                                                     
enc                                                                                                                                            
xpri      

Comments

Popular posts from this blog

c++ program to print string along the diagonals of the matrix.

Kollywood Game

C program to print the following Pattern