The number of repeated letters in two words
#include <stdio.h>
#include<string.h>
int main(void) {
int n,m,i,j,d;
char tab1[100],tab2[100];
printf("enter the first word :");
gets(tab1);
printf("enter the second word :");
gets(tab2);
n=strlen(tab1);
m=strlen(tab2);
do{
if(m==n){
printf("Two words with the same number of letters\n");
}
else{
printf("Two words that do not have the same number of letters, try again\n");
}
}while (n!=m);
d=0;
for (i=0;i<n;i++){
for(j=0;j<m;j++){
if (tab1[i]==tab2[j])
d=d+1;
}
}
printf("The number of duplicate characters is :%d",d);
return 0;
}