题目描述
输入一行字符串(可能包含空格),输出其中出现频率最高的数字,
如果频率相同,则都输出(从小到大),使用空格隔开。
如果没有数字,输出 null。
输入格式
一行字符串。
输出格式
一行整数,从小到大,使用空格隔开,最后一个数附带一个空格。
输入输出样例
输入
I am 60.60 kg.
输出
0 6
说明
字符串内的数字字符有 6 0 6 0,最高的频率为 2,
对应的数字为 6 和 0,从小到大排序,输出为 0 6。
参考代码
#include <iostream>
using namespace std;
struct num{
int value;
int times;
};
int main()
{
char s[64];
cin.getline(s,64);
num n[10]={
{
0,0}};
char *p = s;
for(int i