Class program {static void main (string [] ARGs) {console. writeline (next ("abc123def345ghi"); console. read ();} Private Static string next (string s) {If (! Isnumber (S. substring (S. length-1, 1) S = S + "0"; matchcollection coll = RegEx. matches (S, @ "\ D +"); match M = Coll [Coll. count-1]; return S. substring (0, M. index) + nextnum (M. value);} Private Static string nextnum (string s) {char [] cs = S. tochararray (); For (INT I = S. length-1; I> = 0; I --) {If (! Nextchar (ref CS [I]) break;} string Re = new string (CS); If (int32.parse (re) = 0) Re = "1" + RE; return re;} Private Static bool nextchar (ref char c) {string P = "01234567890123456789"; int n = P. indexof (c); C = P [(n + 1) % 10 + 10 * (N/10)]; return (n = 9 | n = 19);} public static bool isnumber (string Str) {RegEx r = new RegEx (@ "^ \ D + (\.)? \ D * $ "); If (R. ismatch (STR) {return true ;}else {return false ;}}