class Solution {
public:
//将数字转成字符串
string itos(int n) {
if (n == 0)return"0";
string s;
while (n) {
s += '0' + n % 10;
n /= 10;
}
reverse(s.begin(),s.end());
return s;
}
bool operator()(string s1, string s2) {
int minlen = min(s1.size(), s2.size());
int maxlen = max(s1.size(), s2.size());
for (int i = 0; i < maxlen; i++) {
if (s1[i%s1.size()] != s2[i%s2.size()])
return s1[i%s1.size()] < s2[i%s2.size()];
}
return s1.size() < s2.size();
}
string PrintMinNumber(vector<int> numbers) {
vector<string>v;
for (int num : numbers)v.push_back(itos(num));
sort(v.begin(), v.end(), Solution());
string res;
for (string str : v)res += str;
return res;
}
};