fork download
  1. #include <vector>
  2. #include <iostream>
  3.  
  4. int main() {
  5.  
  6. std::vector<char> vStr1Even, vStr2Third;
  7.  
  8. std::cin >> std::noskipws;
  9.  
  10. char cTmp;
  11. for (size_t idx = 1U; std::cin >> cTmp && cTmp != '\n'; ++idx) {
  12. if (!(idx & 1U)) {
  13. vStr1Even.push_back(std::move(cTmp));
  14. }
  15. if (!(idx % 3U)) {
  16. vStr2Third.push_back(std::move(cTmp));
  17. }
  18. }
  19.  
  20. for (auto xCh : vStr1Even) {
  21. std::cout << xCh;
  22. }
  23.  
  24. std::cout << std::endl;
  25.  
  26. for (auto xCh : vStr2Third) {
  27. std::cout << xCh;
  28. }
  29.  
  30. std::cout << std::endl;
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 3232KB
stdin
abcdef roteld
stdout
bdfrtl
cfol