using System;using System.Linq;publicclassDigits{publicstaticstringExplode(string s){returnstring.Join("", s.Select(c =>newString(c,int.Parse(c.ToString()))));}}
答案2:
using System;using System.Linq;publicclassDigits{publicstaticstringExplode(string s){string res ="";foreach(char i in s){
res +=newString(i,int.Parse(i.ToString()));}return res;}}
答案3:
using System;using System.Linq;using System.Text;publicclassDigits{publicstaticStringExplode(String s ){var sb =newStringBuilder();
s.ToCharArray().ToList().ForEach( x =>{Int32 number;var isNumber = Int32.TryParse( x.ToString(),out number );
sb.Append( x, isNumber ? number :0);});return sb.ToString();}}
答案4:
using System;using System.Linq;publicclassDigits{publicstaticstringExplode(string s){returnstring.Join("",s.Select(c=>newstring(c,c-48)));}}
答案5:
using System;using System.Linq;publicclassDigits{publicstaticstringExplode(string s){returnstring.Join("", s.Select(a =>newString(a,int.Parse(a.ToString()))));}}
答案6:
using System.Linq;publicclassDigits{publicstaticstringExplode(string s)=>newstring(s.SelectMany(d => Enumerable.Repeat(d,int.Parse(d.ToString()))).ToArray());}
答案7:
using System;using System.Text;publicclassDigits{publicstaticstringExplode(string s){StringBuilder stringBuilder =newStringBuilder();foreach(char ch in s){int number;if(!int.TryParse(ch.ToString(),out number))continue;if(number.Equals(0))continue;for(int i =0; i < number; i++){
stringBuilder.Append(number);}}return stringBuilder.ToString();}}
答案8:
using System;using System.Linq;publicclassDigits{publicstaticstringExplode(string s)=>string.Concat(s.Select(l=>newstring(l,(int)Char.GetNumericValue(l))));}
答案9:
using System;using System.Linq;publicclassDigits{publicstaticstringExplode(string s){var res =string.Empty;int i;string subres;foreach(var ch in s){
i =0;
subres =string.Empty;while(i++<int.Parse(ch.ToString()))
subres += ch;
res += subres;}return res;}}
答案10:
using System;using System.Linq;publicclassDigits{publicstaticstringExplode(string s){// Insert your solution herereturnstring.Concat(s.Select(c =>newstring(c,int.Parse(c.ToString()))));}}