Problem description

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 sis 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
解题思路:取出原字符串中的所有数字字符到一个int数组中,排序,然后按格式输出即可,水过。
AC代码:
 #include<bits/stdc++.h>
using namespace std;
int main(){
char str[];int k=,num[];
cin>>str;
for(int i=;str[i]!='\0';++i)
if(i%==)num[k++]=str[i]-'';
sort(num,num+k);
for(int i=;i<k-;++i)
cout<<num[i]<<'+';
cout<<num[k-]<<endl;
return ;
}
 

B - Helpful Maths的更多相关文章

  1. Codeforces Round #197 (Div. 2) A. Helpful Maths【字符串/给一个连加计算式,只包含数字 1、2、3,要求重新排序,使得连加的数字从小到大】

    A. Helpful Maths time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  2. Codeforces Helpful Maths

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

  3. [ An Ac a Day ^_^ ] CodeForces 339A Helpful Maths

    熄灯了才想起来没写博客 赶紧水一道题碎觉…… #include<stdio.h> #include<iostream> #include<algorithm> #i ...

  4. codeforces水题100道 第二十五题 Codeforces Round #197 A. Helpful Maths (Div. 2) (strings)

    题目链接:http://www.codeforces.com/problemset/problem/339/A题意:重新组合加法字符串,使得按照1,2,3的顺序进行排列.C++代码: #include ...

  5. codeforces 339A.Helpful Maths B.Xenia and Ringroad 两水题

    A.题意就是把字符串里面的数字按增序排列,直接上代码. #include <string.h> #include <stdio.h> #include <algorith ...

  6. Codeforces Round #197 (Div. 2) (A、B、C、D、E五题合集)

    A. Helpful Maths 题目大意 给一个连加计算式,只包含数字 1.2.3,要求重新排序,使得连加的数字从小到大 做法分析 把所有的数字记录下来,从小到大排序输出即可 参考代码 #inclu ...

  7. CodeForces Round 197 Div2

    这次出的题水爆了,借着这个机会终于把CF的号变蓝了.A. Helpful Mathstime limit per test2 secondsmemory limit per test256 megab ...

  8. Codeforces Round #197 (Div. 2)

    A.Helpful Maths 分析:将读入的字符转化为数字,直接排个序就可以了. #include <cstdlib> #include <cstring> #include ...

  9. 欢迎来到 Flask 的世界

    欢迎来到 Flask 的世界 欢迎阅读 Flask 的文档.本文档分成几个部分,我推荐您先读 < 安装 >,然后读< 快速上手 >.< 教程 > 比快速上手文档更详 ...

随机推荐

  1. 取三级分销上下级用户id

    //取上三级的用户idpublic function _get_up_third_id($member_id){ $up_id=array(); $invite_id=dbselect('invite ...

  2. element select下拉框绑定number类型

    vue 开发中element-ui库的switch开关绑定number类型数据不成功问题 解决方法

  3. 解决windows64位系统上安装mysql-python报错

    解决windows64位系统上安装mysql-python报错 2018年03月12日 13:08:24 一个CD包 阅读数:1231    版权声明:本文为博主原创文章,未经博主允许不得转载. ht ...

  4. 【Redis】一、Redis简介及五种数据类型

    (一)Redis简介   Redis(Remote Dictionary Server)是一个使用ANSI C语言编写.遵守BSD协议.支持网络.可基于内存亦可持久化的日志型.Key-Value的开源 ...

  5. Vivaldi解决flash插件问题

    Vivaldi浏览器 Vivaldi是Opera联合创始人.前CEO谭咏文(Jon von Tetzchner)2015年1月27日发布的一款浏览器,具有个性化的笔记功能,带有迷你屏幕截图的书签,以及 ...

  6. Django Template(模板系统)

    一.Django模板 内置模板标签和过滤器 二.常用操作 两种特殊符号: {{  }}  和 {%  %} 变量相关的用: {{  }} 逻辑相关的用: {%  %} 2.1 变量 在Django的模 ...

  7. openoffice启动服务并将office文件转换为pdf文件

    1.首先下载最新版的openoffice工具,安装完成之后安装服务,, win+r打开命令提示符 输入cmd,cd C:\Program Files (x86)\OpenOffice 4\progra ...

  8. 我理解的数据结构(二)—— 栈(Stack)

    我理解的数据结构(二)-- 栈(Stack) 一.栈基础 栈是一种线性结构 相比较数组,栈对应的操作是数组的子集 只能从一端添加元素,也只能从同一端取出元素,这一端称为栈顶 栈是一种后进先出的数据结构 ...

  9. 单例模式的python实现

    # 本实例主要介绍单例模式 # 1.什么是单例模式 # 1. 确保有且只有一个对象被创建 # 2. 为对象提供一个访问点,以使程序可以全局访问该对象 # 3. 控制共享资源的并行访问 # 2.单例模式 ...

  10. hdu_1031_Design T-Shirt_201310291647

    Design T-Shirt Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) T ...