fork(1) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main(void)
  7. {
  8. int t;
  9. cin >> t;
  10. while (t--)
  11. {
  12. string a;
  13. cin >> a;
  14.  
  15. for (int i = 0; i < a.length(); i += 2) //짝수 부분 출력
  16. cout << a[i];
  17. for (int i = 1; i < a.length(); i += 2) //홀수 부분 출력
  18. cout << a[i];
  19. cout << endl;
  20. }
  21. }
Success #stdin #stdout 0.01s 5292KB
stdin
2
A
HelloWorld
stdout
A
HloolelWrd