Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- int t,i,len,count,j;
- char str[10001],ch[2],ce;
- scanf("%d",&t);
- for(j=1; j<=t; j++)
- {
- scanf(" %[^\n]",str);
- len=strlen(str);
- scanf("%s",ch);
- if(ch[0]>='A' && ch[0]<='Z') ce=ch[0]+' ';
- else ce=ch[0];
- count=0;
- for(i=0; i<len; i++)
- {
- if(ce==str[i] || ce==(str[i]+' ')) count++;
- }
- if(count>0)
- {
- printf("Occurrence of '%c' in '%s' = %d\n",ch[0],str,count);
- }
- else
- {
- printf("'%c' is not present\n",ch[0]);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement