using System.Text.RegularExpressions;
public static void Main()
var matches = Regex.Match(str, @"^(\d+)d(\d+)m$");
day = int.Parse(matches.Groups[1].Value);
minute = int.Parse(matches.Groups[2].Value);
var myTimeSpan = new TimeSpan(days: day, hours: 0, minutes: minute, seconds: 0);
Console.Write(myTimeSpan);