fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. string temp;
  10. while(getline(cin, temp))
  11. {
  12. string name, t;
  13. vector<string> reqs;
  14. stringstream ss(temp);
  15. ss >> name;
  16. while(ss >> t)
  17. {
  18. reqs.push_back(t);
  19. }
  20. cout << name;
  21. for(const auto& a : reqs)
  22. cout << " " << a;
  23. cout << endl;
  24. }
  25. }
Success #stdin #stdout 0s 3436KB
stdin
gameDesign java cs3
java cs1
cSharp cs1
cs1 cs0
discreteMath
dataBases
cs2 cs1
advancedGraphics
cs3 cs2
operatingSystems
graphics cs3 operatingSystems
cs0 mathForKids
cs4 cs3 dataBases operatingSystems
bioinformatics discreteMath cs2
assembly cs1
mathForKids
stdout
gameDesign java cs3
java cs1
cSharp cs1
cs1 cs0
discreteMath
dataBases
cs2 cs1
advancedGraphics
cs3 cs2
operatingSystems
graphics cs3 operatingSystems
cs0 mathForKids
cs4 cs3 dataBases operatingSystems
bioinformatics discreteMath cs2
assembly cs1
mathForKids