// split input string to array of strings separated by a space string[] input = Console.ReadLine().Split(' '); // convert each element of input to integer int[] heights = Array.ConvertAll(input, int.Parse);