题目:
题解:
char * originalDigits(char * s)
{
int len=strlen(s);
int arr[26]={0},num[10]={0},cot=0;
for(int i = 0; i < len; i++)
arr[s[i] - 'a']++;
num[0] = arr['z'-'a'];
num[2] = arr['w'-'a'];
num[4] = arr['u'-'a'];
num[6] = arr['x'-'a'];
num[8] = arr['g'-'a'];
num[1] = arr['o'-'a'] - num[4] - num[2] - num[0];
num[3] = arr['t'-'a'] - num[2] - num[8];
num[5] = arr['f'-'a'] - num[4];
num[7] = arr['s'-'a'] - num[6];
num[9] = arr['i'-'a'] - num[8] - num[6] - num[5];
for(int i = 0;i<10;i++)
for(int j = 0;j<num[i];j++)
s[cot++]='0'+i;
s[cot]=0;
return s;
}