We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
static void Main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
//number of test cases
int n = Convert.ToInt32(Console.ReadLine());
string[] s = new string[n];
for(int i = 0; i < s.Length; i++)
{
string even = string.Empty;
string odd = string.Empty;
s[i] = Console.ReadLine();
/*Note that :
string is an array of characters therefore will will convert the 's[i]' to array of 'char'.
*/
char[] c = s[i].ToCharArray();
for(int j = 0; j < c.Length ; j++)
{
// use modulus '%' to check remainder from the indexes
if(j % 2 == 0)
even += c[j];
else
odd += c[j];
}
Console.Write($"{even} {odd}");
Console.WriteLine();
}
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 6: Let's Review
You are viewing a single comment's thread. Return to all comments →
C# Solution class Solution {
}