例如:
输入:1233422222 输出:1121324125
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
int main(int arc, char** argv)
{
char *str="1233422222";
string nstr;
int i=0;
while(1)
{
int cnt=1;
while(str[i+1]==str[i])
{
i++;
cnt++;
}
nstr+=str[i];
nstr+=cnt+'0';
//cout<<str[i]<<cnt;
i++;
if(str[i+1]=='\0')
{
break;
}
}
cout<<nstr<<endl;
system("pause");
return 0;
}