CamelCase in C#

Example for versions gmcs 2.0.1

First line of Main method reads the input string from console and converts it to lowercase. Second line replaces all sequences of 1 or more non-alpha characters with spaces. Two next lines get object of class TextInfo and use it to convert the string to title case (all words start with capital letters). Finally, spaces are removed from the resulting string, and the result is written to console.

using System;
using System.Globalization;
using System.Text.RegularExpressions;
 
public class Program
{   public static void Main(string[] args)
    {   string text = Console.ReadLine().ToLower();
        text = Regex.Replace(text,"([^a-z]+)"," ");
        TextInfo ti = new CultureInfo("en-US",false).TextInfo;
        text = ti.ToTitleCase(text);
        text = text.Replace(" ","");
        Console.WriteLine(text);
    }
}