string num = Console.ReadLine();
string a="";
string b="";
for (int i = num.Length; i > 0; i--)
{
if (num[i] =='-')
{
break;
}
else
{
b +=num[i].ToString();
}
}
//then reverse b
//a=num-(b.lenght+1);
Console.WriteLine(b);``
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in number_spliter.exe
Additional information:
Index was outside the bounds of the array.