Task
Given a string, S , of length N that is indexed from 0 to N-1, print its even-indexed and odd-indexed characters as 2 space-separated strings on a single line (see the Sample below for more detail).
Note:0 is considered to be an even index.
Input Format
The first line contains an integer, T (the number of test cases).
Each line of the subsequent lines contain a String, .
Constraints

Output Format
For each String
even-indexed characters, followed by a space, followed by Sj 's odd-indexed characters.
Sample Input
2
Hacker
Rank
Sample Output
Hce akr
Rn ak
Solution:
Code in C++
Given a string, S , of length N that is indexed from 0 to N-1, print its even-indexed and odd-indexed characters as 2 space-separated strings on a single line (see the Sample below for more detail).
Note:0 is considered to be an even index.
Input Format
The first line contains an integer, T (the number of test cases).
Each line of the subsequent lines contain a String, .
Constraints
Output Format
For each String
even-indexed characters, followed by a space, followed by Sj 's odd-indexed characters.
Sample Input
2
Hacker
Rank
Sample Output
Hce akr
Rn ak
Solution:
Code in C++
No comments:
Post a Comment