Created
December 30, 2016 02:44
-
-
Save dzsquared/bded31c0ce3b31e68a51f10facaab7fa to your computer and use it in GitHub Desktop.
arrays and loops created by dzsquared - https://repl.it/Ewyw/0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
class Solution { | |
static void Main(String[] args) { | |
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */ | |
int lineCount; | |
lineCount = Convert.ToInt32(Console.ReadLine()); | |
for(int i = 1; i <= lineCount; i++) { | |
string theword = Console.ReadLine(); | |
char[] myCharArray = theword.ToCharArray(); | |
string thehalfword = ""; | |
string theotherhalfword = ""; | |
for(int j = 0; j < theword.Length; j++){ | |
if(j % 2 == 0) { | |
// Print each sequential character on the same line | |
thehalfword = thehalfword + myCharArray[j]; | |
} else { | |
theotherhalfword = theotherhalfword + myCharArray[j]; | |
} | |
} | |
Console.WriteLine(thehalfword + " " + theotherhalfword); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment