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