Advertisement
Guest User

new(1)

a guest
Aug 4th, 2018
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6.     char s_line[10001];
  7.     char ch[2];
  8.     int t, i, count;
  9.  
  10.     scanf("%d", &t);
  11.    for (i=0; i<t; i++)
  12.     {
  13.         scanf("%[^\n]", s_line);
  14.         scanf("%s", ch);
  15.     count = 0;
  16.         for (i = 0; i < strlen(s_line); i++)
  17.         {
  18.             if (s_line[i] == ch[0])
  19.             {
  20.                 count++;
  21.             }
  22.         }
  23.  
  24.         if (count == 'NILL')
  25.             printf(" '%s' is not present\n", ch[0]);
  26.  
  27.         else
  28.             printf("Occurrence of '%s' in '%s' = %d\n", ch[0], s_line, count);
  29.     }
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement