• + 0 comments

    C# solution

    using System; using System.Collections.Generic; using System.IO; class Solution { static void Main(String[] args) {

        int n = Convert.ToInt32(Console.ReadLine());  // Read number of test cases (but it's unused)
    
        // Convert string to character array
    
       for(int i=0; i<n;i++){
         string characters = Console.ReadLine(); 
        string result=checkChar.checkindex(characters);
        Console.WriteLine(result);
       }
          // Print result
    }
    class checkChar{
    
        public static string checkindex(string characters){
            // Read input string
    

    string even = ""; // Initialize with empty string string odd = "";

        char[] chars = characters.ToCharArray(); 
             for (int i = 0; i < characters.Length; i++) {  // Fix loop (start from 0, use <)
            if (i % 2 == 0) {  // Check if index is even
                even += chars[i]; 
            } else {
                odd += chars[i];
            }
        }
        return even + " "+ odd;
    
        }
    }
    

    }