1、题目链接:http://codeforces.com/contest/339/problem/A
2、读入的时候要小心。注意回车、加号等。
#include <cstdio>#include <cctype>
#include <algorithm>
using namespace std;
int main()
{
char ch;
int a[100],n;
n=0;
while((ch=getchar())!=EOF){
if(ch=='\n'){
sort(a,a+n);
for(int i=0;i<n;i++){
printf("%d",a[i]);
if(i!=n-1) printf("+");
}
n=0;
printf("\n");
}else if(isdigit(ch))
a[n++]=ch-'0';
}
return 0;
}