fork(2) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. string TextConvert(string text)
  7. {
  8. int licz = 1;
  9. string newText = "";
  10. for(int i = 0; i < text.length(); i++)
  11. {
  12. if(text[i] == ' ')
  13. {
  14. text[i+1] = toupper(text[i+1]);
  15. }
  16. }
  17. for(int i = 0; i < text.length(); i++)
  18. {
  19. if(text[i] == ' ')
  20. {
  21. licz++;
  22. }
  23. else if(text[i] != newText[i-licz])
  24. {
  25. newText += text[i];
  26. }
  27. }
  28. return newText;
  29. }
  30.  
  31. int main()
  32. {
  33. string tekst;
  34. while(getline(cin, tekst))
  35. {
  36. cout << TextConvert(tekst) << endl;
  37. }
  38. return 0;
  39. }
Success #stdin #stdout 0s 3420KB
stdin
Dzisiaj jest czwartek,
A jutro jest piatek.
stdout
DzisiajJestCzwartek,
AJutroJestPiatek.