open System open System.Text let separateStr (arg:string) = let rec splitStr (acc:StringBuilder) (argStr:StringBuilder) = if argStr.Length <= 3 then argStr.ToString() + acc.ToString() else acc.Insert(0,argStr.Chars (argStr.Length-1)) acc.Insert(0,argStr.Chars (argStr.Length-2)) acc.Insert(0,argStr.Chars (argStr.Length-3)) acc.Insert(0, ',' ) argStr.Length <- argStr.Length-3 splitStr acc argStr splitStr (new StringBuilder()) (new StringBuilder(arg)) Console.ReadLine() |> separateStr |> Console.WriteLine