fork download
  1. #include <cstdio>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. unsigned cur = 0, res = ~0U;
  9. int x;
  10. char s[2];
  11. int n;
  12.  
  13. while (1)
  14. {
  15. n = scanf("%d%1[\n]", &x, s);
  16.  
  17. if (n > 0)
  18. ++cur;
  19.  
  20. if (n != 1)
  21. {
  22. cout << cur << endl;
  23. if (cur && cur < res) res = cur;
  24. if (n <= 0) break;
  25. cur = 0;
  26. }
  27. }
  28.  
  29. cout << "Min is " << res << endl;
  30.  
  31. return 0;
  32. }
Success #stdin #stdout 0s 5016KB
stdin
1 2 3
4 5
6 7 8 9
stdout
3
2
4
Min is 2