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