Let's Review Solution in C#

This Page Contains the Solution in C# Programming Language for the Day 6 : Let's Review, Code Challange of the HackerRank 30 Days of Code.

    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 */
            var N = int.Parse(Console.ReadLine());
            Review(N);
        }
        static void Review(int N)
        {
            for (var i = 0; i < N; i++)
            {
                var str = Console.ReadLine();

                for (var j = 0; j < str.Length; j++)
                {
                    if (j % 2 == 0) Console.Write(str[j]);
                }

                Console.Write(" ");

                for (var j = 0; j < str.Length; j++)
                {
                    if (j % 2 != 0) Console.Write(str[j]);
                }
                Console.Write(Environment.NewLine);
            }
        }
    }

Last updated

Was this helpful?