fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. while(!cin.eof())
  9. {
  10. string tmp;
  11. getline(cin, tmp);
  12. stringstream str;
  13. str << tmp;
  14.  
  15. char op;
  16. int a, b;
  17. bool readB = false;
  18.  
  19. str >> op >> a;
  20. if (str >> b) readB = true;
  21.  
  22. cout << op << ' ' << a;
  23. if (readB) cout << ' ' << b;
  24. cout << '\n';
  25. }
  26. }
Success #stdin #stdout 0s 3236KB
stdin
C 1 0
B 1
A 1 2
stdout
C 1 0
B 1
A 1 2