Given two strings count the number of unique characters
Input:
coderegister
codebuilders
Output:
8
Implementation:
Input:
coderegister
codebuilders
Output:
8
Implementation:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void) {
char *s,*v;
int i;
int hash[26],count=0;
memset(hash,0,sizeof(hash));
s=(char*)malloc(sizeof(char)*1000);
v=(char*)malloc(sizeof(char)*1000);
scanf("%s",s);
scanf("%s",v);
i=0;
while(*(s+i) || *(v+i))
{
hash[*(s+i)-'a']++;
hash[*(v+i)-'a']++;
i++;
}
i=0;
while(i<26)
{
hash[i]%=2;
if(hash[i]!=0)
count++;
i++;
}
printf("%d",count);
return 0;
}