fork download
  1. #include <iostream>
  2. #include<stdio.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int a[40],i,count=0;
  7. for(i=0;1;i++)
  8. {
  9. scanf("%d,",&a[i]);
  10. count++;
  11. if(a[i]==0)
  12. break;
  13. }
  14. cout<<count;
  15. // your code goes here
  16. return 0;
  17. }
Success #stdin #stdout 0s 4396KB
stdin
1,2,3,4,5,6,7,8,9,10,11,12
stdout
26