❔ need help with a problem
I wrote this code. The input in this case was "Hacker Rank". It's supposed to output "Hce akr
Rn ak". Instead, it outputted "HHHHHHaaaa". I have no idea why this happened. I must've messed up somewhere.
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 t = int.Parse(Console.ReadLine());
for (int i = 0; i < t; i++){
string s = Console.ReadLine();
for (int o = 0; o < s.Length; o++){
if (o % 2 == 0){
Console.Write(s[i]);
}
}
for (int o = 0; o < s.Length; o++){
if (o % 2 == 1){
Console.Write(s[i]);
}
}
}
}
}