fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int i = 1;
  9. string token;
  10.  
  11. while(cin >> token)
  12. {
  13. cout << i << ": " << token << '\n';
  14. i++;
  15. }
  16. }
Success #stdin #stdout 0s 3020KB
stdin
one
two
three
four
stdout
1: one
2: two
3: three
4: four