This is my code ,and it works fine in Visual Studio ,but when I put here , SPOJ say that is wrong answer, cause Object reference not set to an instance of an object.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Projekat11
{
class Program
{
static void Main(string[] args)
{
try
{
int cases;
do
{
cases = int.Parse(Console.ReadLine());
} while (cases < 1 || cases > 100);
string[] niz = new string[cases];
for (int i = 0; i < cases; i++)
{
do
{
niz[i] = Console.ReadLine();
} while (niz[i].Length % 2 != 0 || niz[i].Length > 200 || string.IsNullOrEmpty(niz[i]));
}
for (int i = 0; i < cases; i++)
{
for (int j = 0; j < niz[i].Length / 2; j += 2)
{
Console.Write(niz[i].ElementAt(j));
}
Console.WriteLine();
}
}
catch (NullReferenceException eX)
{
Console.WriteLine(eX.Message);
}
}
}
}