//C++版代码 #include <iostream> #include <algorithm> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string nums[n]; for (int i = 0; i < n; i++) cin >> nums[i]; sort(nums, nums + n,[](const string &a, const string &b) { return a.length() == b.length() ? a < b : a.length() < b.length(); }); for (const string &num: nums) cout << num << endl; return 0; } //Java版代码 import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); BigInteger[] nums = new BigInteger[n]; for (int i = 0; i < n; i++) nums[i] = sc.nextBigInteger(); Arrays.stream(nums).sorted().forEach(System.out::println); } } #Python版代码 print(*(sorted([int(input()) for _ in range(int(input()))])), sep='\n')