
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <sstream>
#include <algorithm>
#include <string>
#include <ctype.h>
using namespace std;
vector<long long> splitString(string& str, char ch)
{
vector<long long> res;
string tmp;
for (int i = 0; i < str.size(); i++)
{
if (str[i] == ch)
{
while (!tmp.empty() && tmp[0] == '0')
{
tmp.erase(tmp.begin());
}
if (!tmp.empty())
{
res.push_back(stoll(tmp));
}
tmp.clear();
}
else
{
tmp += str[i];
}
}
while (!tmp.empty() && tmp[0] == '0')
{
tmp.erase(tmp.begin());
}
if (!tmp.empty())
{
res.push_back(stoll(tmp));
}
return res;
}
int main()
{
int T;
cin >> T;
while (T--)
{
int len;
string str;
cin >> len >> str;
vector<long long> res = splitString(str, '6');
sort(res.begin(), res.end());
cout << res.size() << endl;
for (int i = 0; i < res.size(); i++)
{
cout << res[i]<<endl;
}
}
return 0;
}
测试样例过了但还是wa,有没有大佬救一下