using System.Collections.Generic;
public static string solution(string s)
string digits = new String(s.Where(Char.IsDigit).ToArray());
int count = digits.Length;
List<string> l = new List<string>();
if (count - temp == 4 || count - temp == 2 || count == 2)
l.Add(digits.Substring(temp, 2));
l.Add(digits.Substring(temp, 3));
return String.Join("-",l);
public static void Main()
string m=solution("12#45@6789");