Code:
#include <stdio.h>
int main() {
int a[26], b[26], i,is_same;
char ch;
for(i=0; i<26; i++){
a[i]=0;
b[i]=0;
}
printf("Input a line of letters: ");
do{
ch =getchar();
scanf("%c", &ch);
if(ch>='a'&&ch<='z')
a[ch-'a']=1;
if(ch>='A'&&ch<='Z')
a[ch-'A']=1;
}while(ch!='\n');
printf("Input a line of letters: ");
do{
ch=getchar();
scanf("%c", &ch);
if(ch>='a'&&ch<='z')
b[ch-'a']=1;
if(ch>='A'&&ch<='z')
b[ch-'B']=1;
}while(ch!='\n');
is_same=1;
for(i=0;i<26;i++){
if(a[i]!=b[i])
is_same=0;
if(is_same==0)
printf("Not same\n");
else
printf("Same");
}
return 0;
}
//Output:
Input a line of letters: AAbc
Input a line of letters: accb
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same
Not same