fork download
  1. #include <iostream>
  2. #include <sstream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. string linia;
  8.  
  9. while(getline(cin, linia)) {
  10. istringstream slinia(linia);
  11. int a;
  12. int n = 0;
  13. while(slinia >> a) ++n;
  14. slinia.clear();
  15. string s;
  16. slinia >> s;
  17.  
  18. cout << s << " ma " << n << " liczb" << endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 3468KB
stdin
1 2 3 kon kot bez nzawy

3 9 3
3 9 123 321399 423 słoń
człowiek
stdout
kon ma 3 liczb
 ma 0 liczb
 ma 3 liczb
słoń ma 5 liczb
człowiek ma 0 liczb