A. Helpful Maths
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Xenia the beginner mathematician is a third year student at elementary school. She is now learning the addition operation.

The teacher has written down the sum of multiple numbers. Pupils should calculate the sum. To make the calculation easier, the sum only contains numbers 1, 2 and 3. Still, that isn't enough for Xenia. She is only beginning to count, so she can calculate a sum only if the summands follow in non-decreasing order. For example, she can't calculate sum 1+3+2+1 but she can calculate sums 1+1+2 and 3+3.

You've got the sum that was written on the board. Rearrange the summans and print the sum in such a way that Xenia can calculate the sum.

Input

The first line contains a non-empty string s — the sum Xenia needs to count. String s contains no spaces. It only contains digits and characters "+". Besides, string s is a correct sum of numbers 1, 2 and 3. String s is at most 100 characters long.

Output

Print the new sum that Xenia can count.

Examples
input
3+2+1
output
1+2+3
input
1+1+3+1+3
output
1+1+1+3+3
input
2
output
2

【代码】:

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm> using namespace std; const int N=100005;
int k;
char s[110];
int a[110]; int main()
{
scanf("%s",s);
for(int i=0;i<strlen(s);i+=2)//+=2
{
a[k++]=s[i]-'0';
}
sort(a,a+k); printf("%d",a[0]);//第一个前面无+,单独输出
for(int i=1;i<k;i++)
printf("+%d",a[i]);
printf("\n");
}

  

最新文章

  1. boxsizing属性 IE盒模型和标准盒模型
  2. String-原型属性
  3. NodeJs和ReactJs单元测试工具——Jest
  4. web.xml 的加载过程
  5. ActiveMQ学习(三)——MQ的通讯模式
  6. php单引号、双引号与数据库
  7. C# 多线程、结构体
  8. [转]C++学习心得
  9. hdu 5730 Shell Necklace fft+cdq分治
  10. Makefile条件推断 ——————————【Badboy】
  11. 解决ie 低版本的 background-size 兼容问题
  12. AP付款出现(-1)例外处理
  13. vfd with stm8
  14. SpringBoot的自动配置原理
  15. jmeter向ActiveMQ发送消息_广播/订阅(Topics 队列)
  16. python 列表 元祖
  17. 一个简单的C语言题背后的故事
  18. Ubuntu 16.04安装sogou 拼音输入法
  19. 自定义指令 格式化input数据为非负整数
  20. Oracle增加一列、修改一列数据类型

热门文章

  1. 将ERF格式转换成PCAP格式
  2. 【一坨理论AC的题】Orz sxy大佬
  3. matlab保存数据
  4. this的五种指法
  5. JasperReport编译报表设计5
  6. 冒泡排序算法[C++]
  7. python时间处理,datetime中的strftime/strptime
  8. 3.appium定位方法
  9. UVA1391/LA3713 Astronauts
  10. mysql本地导入数据