Pagini recente » Cod sursa (job #2571465) | Cod sursa (job #1278370) | Cod sursa (job #542508) | Cod sursa (job #2011634) | Cod sursa (job #109842)
Cod sursa(job #109842)
#include <iostream>
#include <fstream>
#define FIN "ordine.in"
#define FOUT "ordine.out"
#define N_MAX 1000000
using namespace std;
char a[N_MAX];
ifstream fin(FIN);
ofstream fout(FOUT);
int main()
{
int t,n,flag;
fin >> a;
n = strlen(a);
for(int i = 0; i < n; ++i)
for(int j = i+1; j < n; ++j)
if(a[j] < a[i])
t = a[i], a[i] = a[j], a[j] = t;
flag = 0;
for(i = 0; i < n; ++i){
if(a[i] == a[i+1]){
flag = 1;
continue;
}
if(flag){
t = a[i],a[i] = a[i+1],a[i+1] = t;
flag = 0;
}
}
for(i = 0; i < n; ++i)
fout << a[i];
fout << endl;
return 0;
}