看出规律来了
123224
1个1,1个2,1个3,2个2,1个4
11 12 13 22 14
转成字符串,逐个判断 输出就可以了
真没找出来有什么规律,再看看
楼上正解, 果然
using System;
public struct text
{
static void Main()
{
//string a = "123224";
// 1112132214
string a = "1123344";
// 21122324
string c="";
string b="";
if(a[a.Length-1]!=a[a.Length-2]) a += '0';
for (int i = 0; i < a.Length-1; ++i)
{
if (a[i] == a[i +1])
{
c += '2'; c += a[i]; ++i;
}
else
{
c += '1'; c += a[i];
}
}
Console.Write(c);
Console.Read();
}
}