Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- #include<ctype.h>
- void compareStrings(char *s, char *k)
- {
- int d;
- if(strlen(s)>strlen(k))
- {
- d=strlen(s);
- }
- else
- {
- d=strlen(k);
- }
- int i;
- for(i=0;i<d;i++)
- {
- if(*(s+i)==*(k+i))
- {
- *(s+i)=*(k+i)='*';
- }
- }
- }
- int countingStars(char *s)
- {
- int count=0;
- while(*s!='\0')
- {
- if(*s=='*')
- {
- count++;
- }
- s++;
- }
- return count;
- }
- int main()
- {
- char s[100], k[100];
- gets(s);
- gets(k);
- compareStrings(s, k);
- printf("%d\n", countingStars(s));
- puts(s);
- puts(k);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement