PROBLEMA SE POATE FACE SI MAI ELEGANT SI CHIAR LINIAR DAR ASTA E CEL MAI USOR DE INTELES
#include<fstream>
using namespace std;
int main() {
int n = 0, v[21], n1 = 0, n2 = 0;
ifstream fin("numere7.in");
fin >> n1 >> n2;
fin.close();
ofstream fout("numere7.out");
if (n1 == 0 && n2 == 0)
fout << 0;
else {
if (n1 == 0)
n++;
while (n1 != 0) {
v[++n] = n1 % 10;
n1 /= 10;
}
if (n2 == 0)
n++;
while (n2 != 0) {
v[++n] = n2 % 10;
n2 /= 10;
}
for (int i = 1; i <= n - 1; i++)
for (int j = i + 1; j <= n; j++)
if (v[i] > v[j]) {
int aux = v[i];
v[i] = v[j];
v[j] = aux;
}
if (v[1] == 0) {
int i = 1;
while (v[i] == 0)
i++;
v[1] = v[i];
v[i] = 0;
}
for (int i = 1; i <= n; i++)
fout << v[i];
}
fout.close();
return 0;
}