public static void Main(string[] args)
Console.WriteLine(Switch("Петров Иван"));
Console.WriteLine(Switch("Петров"));
Console.WriteLine(Switch("Петров Иван Сергеевич"));
Console.WriteLine(Switch("Петров Иван Люк оглы"));
private static string Switch(string fullname) {
var firstSpace = fullname.IndexOf(' ');
name = string.Format("{0} {1}", fullname.Substring(firstSpace + 1), fullname.Substring(0, firstSpace));