Advertisement
imran018

NUMBER COUNTER

Mar 28th, 2020
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int T, i, count = 0;
  7.     long input;
  8.     char s[100000];
  9.     char *q, *e;
  10.     scanf("%d",&T);
  11.  
  12.     for (i=1;i<=T;i++) {
  13.         gets(s);
  14.         for(q = s; ;q = e) {
  15.             input = strtol(q, &e, 10);
  16.             if (q == e) {
  17.                 break;
  18.             }
  19.             count++;
  20.         }
  21.         printf("%d\n",count);
  22.         count = 0;
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement