using System; using System.Text.RegularExpressions; namespace y { class Program { static void Main(string[] args) { int t = int.Parse(Console.ReadLine()); string[] ans = new string[t]; for (int i = 0; i < t; i++) { string s = Console.ReadLine(); MatchCollection m = Regex.Matches(s, @"[0-9]+"); string a = ""; foreach (var v in m) { if (v.ToString().Length >= a.Length) a = v.ToString(); } if (a.Length != 0) { string y = ""; for (int j = 0; j < a.Length; j++) { y += "0"; } int h = s.LastIndexOf(a); s = s.Remove(h, a.Length); s = s.Insert(h, (int.Parse(a) + 1).ToString(y)); } ans[i] = s; } foreach (var item in ans) { Console.WriteLine(item); } } } }