using System.Collections;
using System.Collections.Generic;
public static void Main()
Console.WriteLine(Mask("4556364607935616"));
public static string Mask(string s)
if (string.IsNullOrEmpty(s))
return "String is not in proper format";
string number_s = "0123456789";
string temp = string.Empty;
string rem_s = s.Substring(1, length_s-5);
foreach (char ch in rem_s)
if (number_s.Contains(ch.ToString()))
temp = temp+ ch.ToString();
temp = s[0].ToString()+temp+s.Substring(length_s-4,4);