package main

import "fmt"
import "sort"

func triangle(L []int, diff int) bool {
	for i := 0; i < 4; i++ {
		for j := i + 1; j < 4; j++ {
			for k := j + 1; k < 4; k++ {
				if (L[i] + L[j] - L[k]) >= diff {
					return true
				}
			}
		}
	}
	return false
}

func main() {
	var L = make([]int, 4)
	_, _ = fmt.Scanf("%d %d %d %d", &L[0], &L[1], &L[2], &L[3])
	sort.Ints(L)
	if triangle(L, 1) {
		fmt.Println("TRIANGLE")
	} else if triangle(L, 0) {
		fmt.Println("SEGMENT")
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"math"
	"os"
)

var cs map[int]int = make(map[int]int)

func Init() {}
func Solve(io *FastIO) {
	a := io.NextIntArray(4)
	var b []int
	res := float64(0)
	for i := range a {
		b = make([]int, 0)
		for j := range a {
			if j != i {
				b = append(b, a[j])
			}
		}
		res = math.Max(check(b[0], b[1], b[2], 0), res)
	}
	switch int(res) {
	case 0:
		io.Println("IMPOSSIBLE")
	case 1:
		io.Println("SEGMENT")
	case 2:
		io.Println("TRIANGLE")
	}
}
func check(a, b, c, co int) float64 {
	if co > 2 {
		return float64(2)
	}
	s := b + c
	var res float64
	if s == a {
		res = float64(1)
	} else if s > a {
		res = check(b, c, a, co+1)
	} else {
		res = float64(0)
	}
	return res
}

type FastIO struct {
	//by megaspazz
	reader *bufio.Reader
	writer *bufio.Writer
}

func (io *FastIO) NextChar() byte {
	c, _ := io.reader.ReadByte()
	return c
}
func (io *FastIO) NextInt() int {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := 1
	if c == '-' {
		sgn = -1
		c = io.NextChar()
	}
	res := 0
	for !IsSpaceChar(c) {
		res = res*10 + int(c-'0')
		c = io.NextChar()
	}
	return res * sgn
}
func (io *FastIO) NextLong() int64 {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	sgn := int64(1)
	if c == '-' {
		sgn = int64(-1)
		c = io.NextChar()
	}
	res := int64(0)
	for !IsSpaceChar(c) {
		res = res*10 + int64(c-'0')
		c = io.NextChar()
	}
	return res * sgn
}
func (io *FastIO) NextIntArray(size int) []int {
	return io.NextIntArrayOffset(size, 0)
}
func (io *FastIO) NextIntArrayOffset(size, offset int) []int {
	arr := make([]int, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextInt()
	}
	return arr
}
func (io *FastIO) NextLongArray(size int) []int64 {
	return io.NextLongArrayOffset(size, 0)
}
func (io *FastIO) NextLongArrayOffset(size, offset int) []int64 {
	arr := make([]int64, size+offset)
	for i := 0; i < size; i++ {
		arr[i+offset] = io.NextLong()
	}
	return arr
}
func (io *FastIO) NextString() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsSpaceChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}
func (io *FastIO) NextLine() string {
	c := io.NextChar()
	for IsSpaceChar(c) {
		c = io.NextChar()
	}
	var sb bytes.Buffer
	for !IsLineBreakChar(c) {
		sb.WriteByte(c)
		c = io.NextChar()
	}
	return sb.String()
}
func (io *FastIO) Println(args ...interface{}) {
	io.writer.WriteString(fmt.Sprintln(args...))
}
func (io *FastIO) Printf(format string, args ...interface{}) {
	io.writer.WriteString(fmt.Sprintf(format, args...))
}
func (io *FastIO) FlushOutput() {
	io.writer.Flush()
}
func IsSpaceChar(c byte) bool {
	switch c {
	case 0, '\t', '\n', '\r', ' ':
		return true
	default:
		return false
	}
}
func IsLineBreakChar(c byte) bool {
	switch c {
	case 0, '\n', '\r':
		return true
	default:
		return false
	}
}
func main() {
	io := FastIO{reader: bufio.NewReader(os.Stdin), writer: bufio.NewWriter(os.Stdout)}
	Init()
	Solve(&io)
	io.FlushOutput()
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var a, b, c, d int

	fmt.Fscanf(reader, "%d %d %d %d", &a, &b, &c, &d)

	if a > b {
		a, b = b, a
	}
	if c > d {
		c, d = d, c
	}
	if a > c {
		a, c = c, a
	}
	if b > d {
		b, d = d, b
	}
	if b > c {
		b, c = c, b
	}

	if a+b > c || b+c > d {
		fmt.Printf("TRIANGLE")
	} else if a+b == c || b+c == d {
		fmt.Printf("SEGMENT")
	} else {
		fmt.Printf("IMPOSSIBLE")
	}

}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var numbers = make([]int, 4)
	fmt.Scan(&numbers[0], &numbers[1], &numbers[2], &numbers[3])
	sort.Ints(numbers)
	if numbers[2] < (numbers[0]+numbers[1]) || numbers[3] < (numbers[2]+numbers[1]) {
		fmt.Println("TRIANGLE")
	} else if numbers[2] == (numbers[0]+numbers[1]) || numbers[3] == (numbers[2]+numbers[1]) {
		fmt.Println("SEGMENT")
	} else {
		fmt.Println("IMPOSSIBLE")
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	A := readNNums(reader, 4)

	fmt.Println(solve(A))
}

func readInt(bytes []byte, from int, val *int) int {
	i := from
	sign := 1
	if bytes[i] == '-' {
		sign = -1
		i++
	}
	tmp := 0
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + int(bytes[i]-'0')
		i++
	}
	*val = tmp * sign
	return i
}

func readNum(reader *bufio.Reader) (a int) {
	bs, _ := reader.ReadBytes('\n')
	readInt(bs, 0, &a)
	return
}

func readTwoNums(reader *bufio.Reader) (a int, b int) {
	res := readNNums(reader, 2)
	a, b = res[0], res[1]
	return
}

func readThreeNums(reader *bufio.Reader) (a int, b int, c int) {
	res := readNNums(reader, 3)
	a, b, c = res[0], res[1], res[2]
	return
}

func readNNums(reader *bufio.Reader, n int) []int {
	res := make([]int, n)
	x := 0
	bs, _ := reader.ReadBytes('\n')
	for i := 0; i < n; i++ {
		for x < len(bs) && (bs[x] < '0' || bs[x] > '9') {
			x++
		}
		x = readInt(bs, x, &res[i])
	}
	return res
}

func readUint64(bytes []byte, from int, val *uint64) int {
	i := from

	var tmp uint64
	for i < len(bytes) && bytes[i] >= '0' && bytes[i] <= '9' {
		tmp = tmp*10 + uint64(bytes[i]-'0')
		i++
	}
	*val = tmp

	return i
}

func solve(A []int) string {
	sort.Ints(A)

	if A[3] < A[2]+A[1] {
		return "TRIANGLE"
	}
	if A[2] < A[0]+A[1] {
		return "TRIANGLE"
	}

	if A[3] == A[1]+A[2] || A[3] == A[0]+A[1] || A[3] == A[0]+A[2] || A[2] == A[0]+A[1] {
		return "SEGMENT"
	}

	return "IMPOSSIBLE"
}

package main
import (
	"fmt"
	"sort"
)
func main() {
	v:=make([]int,4)
	for i:=0;i<4;i++ {
		fmt.Scan(&v[i])
	}
	sort.Ints(v)
	if v[0]+v[1]>v[2] || v[1]+v[2]>v[3] {
		fmt.Println("TRIANGLE")
	} else if v[0]+v[1]==v[2] || v[1]+v[2]==v[3] {
		fmt.Println("SEGMENT")
	} else {
		fmt.Println("IMPOSSIBLE")
	}

}

//
// What we need to do is apply "Heron's Formula" for the area
// of a triangle with known length of sides.
//
// For convience, compute half perimeter:
// s = (a + b + c) / 2
//
// Then A = sqrt(s * (s - a) * (s - b) (s - c))
//
// If A is imaginary, the sides aren't longth enough to form
// a triangle. If A is zero, it forms a degenerate triangle
//
// A degenerate triangle is one where len(AB) + len(BC) = len(AC)
//
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

func solve() {
	a := float64(readInt())
	b := float64(readInt())
	c := float64(readInt())
	d := float64(readInt())

	combs := [...]float64{a, b, c, d}
	degenerate := false

	eps := 0.0001
	for i, va := range combs {
		for j := i + 1; j < len(combs); j++ {
			vb := combs[j]
			for k := j + 1; k < len(combs); k++ {
				vc := combs[k]
				a = area(va, vb, vc)

				if a > eps {
					fmt.Println("TRIANGLE")
					return
				}
				if math.Abs(a) < eps {
					degenerate = true
				}
			}
		}
	}

	if degenerate {
		fmt.Println("SEGMENT")
		return
	}
	fmt.Println("IMPOSSIBLE")
}

func area(a, b, c float64) float64 {
	neg := false

	s := (a + b + c) / 2.0
	area := s * (s - a) * (s - b) * (s - c)

	if area < 0 {
		neg = true
		area = -area
	}

	area = math.Sqrt(area)

	if neg {
		area = -area
	}
	return area
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

package main
import "fmt"

func max3(x, y, z int) (int, bool){
	if (x >= y) && (x >= z) && ((x - y - z) <= 0){
		return x - y - z, true
	}else if (y >= x) && (y >= z) && ((y - x - z) <= 0){
		return y - x - z, true
	}else if (z>=y)&&(z >= x)&&((z-y-x) <= 0){
		return z-y-x, true
	}else{
		return 0, false
	}
}

func main() {
	sticks := make([]int, 4)
	fmt.Scan(&sticks[0], &sticks[1], &sticks[2], &sticks[3])
	ans := "IMPOSSIBLE"
	for i := 0; i < 4; i++{
		if c, ok:= max3(sticks[i%4], sticks[(i+1)%4], sticks[(i+2)%4]); (c < 0) && ok {
			ans = "TRIANGLE"
			break
		}else if (c == 0) && ok{
			ans = "SEGMENT"
		}
	}

	fmt.Print(ans)
}

//http://codeforces.com/contest/6/problem/A
//A. Triangle

package main

import (
	"fmt"
)

func isTri(a, b, c int32) int32 {
	if a > c {
		c, a = a, c
	}
	if c < b {
		c, b = b, c
	}
	if b < a {
		b, a = a, b
	}
	if a+b > c {
		return 1
	}
	if a+b == c {
		return 0
	}
	return -1
}

func main() {
	var (
		res, t, a, b, c, d int32
	)

	fmt.Scan(&a)
	fmt.Scan(&b)
	fmt.Scan(&c)
	fmt.Scan(&d)
	res = isTri(a, b, c)
	t = isTri(a, b, d)
	if t > res {
		res = t
	}
	t = isTri(a, c, d)
	if t > res {
		res = t
	}
	t = isTri(b, c, d)
	if t > res {
		res = t
	}

	if res > 0 {
		fmt.Println("TRIANGLE")
		return
	}
	if res < 0 {
		fmt.Println("IMPOSSIBLE")
		return
	}
	fmt.Println("SEGMENT")

}

package main

import (
	"fmt"
)

func main() {
	var l [4]int
	if _, err := fmt.Scanf("%d %d %d %d\n", &l[0], &l[1], &l[2], &l[3]); err != nil {
		return
	}

	segment := false

	var t [3]int
	for i := 0; i < 4; i++ {
		k := 0
		for j := 0; j < 4; j++ {
			if j != i {
				t[k] = l[j]
				k++
			}
		}
		s := triangle(t)
		if s == 1 { // triangle
			fmt.Println("TRIANGLE")
			return
		} else if s == 2 { // Degenerate triangle
			segment = true
		}
	}

	if segment {
		fmt.Println("SEGMENT")
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}

func triangle(t [3]int) int {
	sum := 0
	max := 0
	for i := 0; i < 3; i++ {
		sum += t[i]
		if t[i] > max {
			max = t[i]
		}
	}

	if sum-max == max {
		return 2
	} else if sum-max > max {
		return 1
	} else {
		return 0
	}
}

package main

import "fmt"

func f(a,b,c int) int {
    if ((a+b) > c) && ((a+c) > b) && ((b+c) > a) {
        return 2
    } else if ((a+b) >= c) && ((a+c) >= b) && ((b+c) >= a) {
        return 1
    } else {
        return 0
    }
}

func max(a... int) (max int) {
    max = a[0]
    for _, v := range a {
        if max < v { max = v }
    }
    return
}

func main() {
    var a,b,c,d int
    fmt.Scan(&a,&b,&c,&d)
    ans := max(f(a,b,c),f(a,b,d),f(a,c,d),f(b,c,d))
    if ans == 2 {
        fmt.Println("TRIANGLE")
    } else if ans == 1 {
        fmt.Println("SEGMENT")
    } else {
        fmt.Println("IMPOSSIBLE")
    }
}

package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"sort"
	"strconv"
	"strings"
	"text/scanner"
)

func check(e error) {
	if e != nil {
		panic(e)
	}
}

func main() {
	var inputs []int

	inputs = make([]int, 4)

	dat, err := ioutil.ReadAll(os.Stdin)
	check(err)
	var str_data string = string(dat);

	reader := strings.NewReader(str_data)

	var scn scanner.Scanner
	scn.Init(reader)

    scn.Scan()
	var text string = scn.TokenText();

	inputs[0], err = strconv.Atoi(text)
	check(err)

	scn.Scan()
	text = scn.TokenText();

	inputs[1], err = strconv.Atoi(text)
	check(err)

	scn.Scan()
	text = scn.TokenText();

	inputs[2], err = strconv.Atoi(text)
	check(err)

	scn.Scan()
	text = scn.TokenText();

	inputs[3], err = strconv.Atoi(text)
	check(err)

	sort.Ints(inputs)

	// first check to see if you can make a triangle with first input
	// otherwise, check for degenerate case
	if inputs[0] + inputs[1] > inputs[2] ||
	   inputs[0] + inputs[2] > inputs[3] ||
	   inputs[1] + inputs[2] > inputs[3] {
		fmt.Print("TRIANGLE")
	} else if inputs[0] + inputs[1] == inputs[2] ||
	   inputs[0] + inputs[2] == inputs[3] ||
	   inputs[1] + inputs[2] == inputs[3] {
	   	fmt.Print("SEGMENT")
	} else {
		fmt.Print("IMPOSSIBLE")
	}

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	var l1, l2, l3, l4 int

	if scanner.Scan() {
		line := scanner.Text()
		fmt.Sscanf(line, "%d %d %d %d", &l1, &l2, &l3, &l4)

		lines := [4]int{l1, l2, l3, l4}

		degenerate := false
		for i := 0; i < 4; i++ {
			for j := i + 1; j < 4; j++ {
				for k := j + 1; k < 4; k++ {
					if lines[i]+lines[j] > lines[k] &&
						lines[i]+lines[k] > lines[j] &&
						lines[j]+lines[k] > lines[i] {
						fmt.Println("TRIANGLE")
						return
					}
					if lines[i]+lines[j] == lines[k] ||
						lines[i]+lines[k] == lines[j] ||
						lines[j]+lines[k] == lines[i] {
						degenerate = true
					}
				}
			}
		}

		if degenerate {
			fmt.Println("SEGMENT")
		} else {
			fmt.Println("IMPOSSIBLE")
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
)

var inf int = 0x3f3f3f3f
var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

var n int
var a [4]int

func main() {
	n = 4
	for i := 0; i < 4; i++ {
		fmt.Fscan(reader, &a[i])
	}
	sort.Sort(sort.IntSlice(a[:]))
	if a[0]+a[1] > a[2] || a[1]+a[2] > a[3] {
		fmt.Println("TRIANGLE")
		return
	}
	if a[0]+a[1] == a[2] || a[1]+a[2] == a[3] {
		fmt.Println("SEGMENT")
		return
	}
	fmt.Println("IMPOSSIBLE")
}

package main

import (
	"bufio"
	"os"
	"strings"
	"fmt"
	"strconv"
	"errors"
	"sort"
)

func main() {
	l := make([]int, 4)
	for i := 0; i < 4; i++ {
		l[i] = nextInt()
	}
	sort.Ints(l)
	triangle, segment := l[0] + l[1] > l[2] || l[1] + l[2] > l[3], l[0] + l[1] == l[2] || l[1] + l[2] == l[3]

	if triangle {
		printf("TRIANGLE\n")
	} else if segment {
		printf("SEGMENT")
	} else {
		printf("IMPOSSIBLE")
	}
}

var lineScanner *bufio.Scanner
var wordScanner *bufio.Scanner

func init() {
	lineScanner = bufio.NewScanner(os.Stdin)
	wordScanner = bufio.NewScanner(strings.NewReader(""))
	wordScanner.Split(bufio.ScanWords)
}
func printf(format string, a ...interface{}) {
	fmt.Printf(format, a...)
}
func nextLine() (string, error) {
	if !lineScanner.Scan() {
		if err := lineScanner.Err(); err != nil {
			panic(err)
		}
		return "", errors.New("nextLine: EOF reached")
	}
	return lineScanner.Text(), nil
}

func nextWord() string {
	for !wordScanner.Scan() {
		if err := wordScanner.Err(); err != nil {
			panic(err)
		}
		line, err := nextLine()
		if err != nil {
			return ""
		}
		wordScanner = bufio.NewScanner(strings.NewReader(line))
		wordScanner.Split(bufio.ScanWords)
	}
	return wordScanner.Text()
}

func nextInt() int {
	res, err := strconv.Atoi(nextWord())
	if err != nil {
		panic(err)
	}
	return res
}

func nextInt64() int64 {
	res, err := strconv.ParseInt(nextWord(), 10, 64)
	if err != nil {
		panic(err)
	}
	return res
}

func nextFloat64() float64 {
	res, err := strconv.ParseFloat(nextWord(), 64)
	if err != nil {
		panic(err)
	}
	return res
}

// 6A-mic
package main

import (
    "fmt"
    "sort"
)

func main() {
    l := make([]int, 4)
    fmt.Scan(&l[0], &l[1], &l[2], &l[3])
    sort.Sort(sort.IntSlice(l))
    if l[0]+l[1] > l[2] || l[1]+l[2] > l[3] {
        fmt.Println("TRIANGLE")
    } else if l[0]+l[1] == l[2] || l[1]+l[2] == l[3] {
        fmt.Println("SEGMENT")
    } else {
        fmt.Println("IMPOSSIBLE")
    }

}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
	strings "strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	text, _, _ := reader.ReadLine()

	val := strings.Split(string(text), " ")
	var val2 [4]int64

	var val3 = make([]int, 4, 4)

	val2[0], _ = strconv.ParseInt(val[0], 10, 0)
	val2[1], _ = strconv.ParseInt(val[1], 10, 0)
	val2[2], _ = strconv.ParseInt(val[2], 10, 0)
	val2[3], _ = strconv.ParseInt(val[3], 10, 0)
	val3[0] = int(val2[0])
	val3[1] = int(val2[1])
	val3[2] = int(val2[2])
	val3[3] = int(val2[3])

	sort.Ints(val3)

	if val3[3] < val3[2]+val3[1] || val3[2] < val3[1]+val3[0] {
		fmt.Println("TRIANGLE")
	} else if val3[3] == val3[2]+val3[1] || val3[2] == val3[1]+val3[0] {
		fmt.Println("SEGMENT")
	} else {
		fmt.Println("IMPOSSIBLE")
	}

}

package main
import "fmt"

func max3(x, y, z int) (int, bool){
	if (x > y) && (x > z) && ((x - y - z) <= 0){
		return x - y - z, true
	}else if (y > x) && (y > z) && ((y - x - z) <= 0){
		return y - x - z, true
	}else if (z>y)&&(z > x)&&((z-y-x) <= 0){
		return z-y-x, true
	}else{
		return 0, false
	}
}

func main() {
	sticks := make([]int, 4)
	fmt.Scan(&sticks[0], &sticks[1], &sticks[2], &sticks[3])
	ans := "IMPOSSIBLE"
	for i := 0; i < 4; i++{
		if c, ok:= max3(sticks[i%4], sticks[(i+1)%4], sticks[(i+2)%4]); (c < 0) && ok {
			ans = "TRIANGLE"
			break
		}else if (c == 0) && ok{
			ans = "SEGMENT"
		}
	}

	fmt.Print(ans)
}

package main

import (
	"fmt"
)

func main() {
	var l [4]int
	if _, err := fmt.Scanf("%d %d %d %d\n", &l[0], &l[1], &l[2], &l[3]); err != nil {
		return
	}

	segment := false

	var t [3]int
	for i := 0; i < 4; i++ {
		k := 0
		for j := 0; j < 4; j++ {
			if j != i {
				t[k] = l[j]
				k++
			}
		}
		s := traingle(t)
		if s == 1 { // Traingle
			fmt.Println("TRAINGLE")
			return
		} else if s == 2 { // Degenerate Traingle
			segment = true
		}
	}

	if segment {
		fmt.Println("SEGMENT")
	} else {
		fmt.Println("IMPOSSIBLE")
	}
}

func traingle(t [3]int) int {
	sum := 0
	max := 0
	for i := 0; i < 3; i++ {
		sum += t[i]
		if t[i] > max {
			max = t[i]
		}
	}

	if sum-max == max {
		return 2
	} else if sum-max > max {
		return 1
	} else {
		return 0
	}
}


package main

import (
	"bufio"
	"fmt"
	"io"
	"math/rand"
	"os"
)

const INF  = 1000000001

type Pair struct {
	first, second int
}

func sort(arr []Pair) []Pair {
	if len(arr) < 2 {
		return arr
	}
	left := 0
	right := len(arr) - 1
	pivot := rand.Int() % len(arr)

	arr[pivot], arr[right] = arr[right], arr[pivot]

	for i := 0; i < len(arr); i++ {
		if arr[i].first > arr[right].first {
			arr[i], arr[left] = arr[left], arr[i]
			left++
		}
	}

	arr[left], arr[right] = arr[right], arr[left]

	sort(arr[:left])
	sort(arr[left+1:])
	return arr
}

func sort2(arr []int) []int {
	if len(arr) < 2 {
		return arr
	}
	left := 0
	right := len(arr) - 1
	pivot := rand.Int() % len(arr)

	arr[pivot], arr[right] = arr[right], arr[pivot]

	for i := 0; i < len(arr); i++ {
		if arr[i] < arr[right] {
			arr[i], arr[left] = arr[left], arr[i]
			left++
		}
	}

	arr[left], arr[right] = arr[right], arr[left]

	sort2(arr[:left])
	sort2(arr[left+1:])
	return arr
}

func gcd (a, b int64) int64 {
	if b == 0 {
		return a
	}
	return gcd (b, a % b);
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func solution(reader io.Reader, writer io.Writer) {
	var n int
	fmt.Fscanf(reader, "%d", &n)
	if n >= 0 {
		fmt.Println(n)
	} else {
		n = -n
		a := n % 10
		n /= 10
		b := n % 10
		n /= 10
		n *= 10
		fmt.Println((n + min(a, b)) * -1)
	}
}

func main() {

	//stdin, err := os.Open("file.in")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdin.Close()
	stdin := os.Stdin
	reader := bufio.NewReaderSize(stdin, 1024*1024)

	//stdout, err := os.Create("file.out")
	//if err != nil {
	//	panic(err)
	//}
	//defer stdout.Close()
	stdout := os.Stdout
	writer := bufio.NewWriterSize(stdout, 1024*1024)
	defer writer.Flush()

	solution(reader, writer)
}

package main
import (
	"fmt"
)
func main() {
	var n int
	fmt.Scan(&n)
	if n >= 0 {
		fmt.Println(n)
	} else {
		k:= n/10
		j:= n/100 * 10 + n %10
		if k > j {
			fmt.Println(k)
		} else {fmt.Println(j)}
	}
}

package main

import (
	"fmt"
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	if n < 0 {
		n = -n
		last := n % 10
		steplast := (n / 10) % 10
		n = (n/100)*10 + min(last, steplast)
		n = -n
	}
	fmt.Print(n)
}

package main

import "fmt"

func main() {
    var s string
    fmt.Scan(&s)
    if s[0] == '-' {
        ans, len := 0, len(s)
        for i := 1; i < (len-2); i++ {
            ans = (ans*10) + int(s[i]-'0')
        }
        if s[len-1] < s[len-2] {
            ans = (ans*10) + int(s[len-1]-'0')
        } else {
            ans = (ans*10) + int(s[len-2]-'0')
        }
        fmt.Println(-ans)
    } else {
        fmt.Println(s)
    }
}

package main

import (
	"bufio"
	"os"

	"fmt"
	"strconv"
)

func getString() string {
	sc := bufio.NewScanner(os.Stdin)
	for sc.Scan() {
		return sc.Text()
	}
	return sc.Text()
}

func main() {
	str := getString()
	acc, _ := strconv.Atoi(str)
	if acc > 0 {
		fmt.Println(acc)
	} else {
		str1 := string(str[0 : len(str)-1])
		str2 := string(str[0:len(str)-2]) + string(str[len(str)-1])
		number1, _ := strconv.Atoi(str1)
		number2, _ := strconv.Atoi(str2)
		if number1 > number2 {
			fmt.Println(number1)
		} else {
			fmt.Println(number2)
		}
	}
}

package main

import "fmt"

func main() {
	var account int64
	fmt.Scan(&account)

	if account >= 0 || account/10 == 0 {
		fmt.Print(account)
	} else {
		account *= -1
		last := account % 10
		account /= 10
		ten := account % 10
		account -= ten

		if last > ten {
			fmt.Print(-1 * (account + ten))
		} else {
			fmt.Print(-1 * (account + last))
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var reader *bufio.Reader

func init() {
	stdin := os.Stdin
	// stdin, _ = os.Open("1.in")
	reader = bufio.NewReaderSize(stdin, 1<<20)
}

// Max Max
func Max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

var s string

func main() {
	fmt.Fscan(reader, &s)
	if s[0] != '-' {
		fmt.Println(s)
		return
	}
	n := len(s)
	a, _ := strconv.Atoi(s[0 : n-1])
	b, _ := strconv.Atoi(s[0:n-2] + s[n-1:n])
	fmt.Println(Max(a, b))
}

package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"strconv"
)

// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

// -----------------------------------------------------------------------------

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// -----------------------------------------------------------------------------

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}

func main() {
	defer Flush()

	n := readi()
	a := n / 10
	b := n/100*10 + n%10
	println(max(n, max(a, b)))
}

package main

import (
	"fmt"
)

func main() {
	var n int64
	fmt.Scan(&n)
	if n >= 0 {
		fmt.Println(n)
	} else {
		lastd := n % 10
		seclastd := (n / 10) % 10
		n = n / 100
		if n*10+lastd > n*10+seclastd {
			fmt.Println(n*10 + lastd)
		} else {
			fmt.Println(n*10 + seclastd)
		}
	}
}

// 313A-mic
package main

import (
    "fmt"
    "math"
)

func main() {
    var n int
    fmt.Scan(&n)
    if n >= 0 {

    } else {
        n = int(math.Max(float64(n/10), float64((n/100)*10+(n%10))))
    }
    fmt.Println(n)
}

package main
import (
    "fmt"
)
func main() {
    var n int // 1
    fmt.Scan(&n)
    if n >= 0 { //1 + 1
        fmt.Println(n)
    } else {
        k:= n/10// 1
        j:= n/100 * 10 + n %10 // 1 + 1
        if k > j {// 1 + 1
            fmt.Println(k)
        } else {fmt.Println(j)}
    }
}

package main
import (
    "fmt"
)
func main() {
    var n int
    var x int
    var y int
    fmt.Scan(&n)
    x= n/10
    y= n/100 * 10 + n %10
    if n >= 0 {
        fmt.Println(n)
    }else if x > y {
            fmt.Println(x)
        } else {fmt.Println(y)
    }

    }

package main

import "fmt"

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// https://codeforces.com/problemset/problem/4/A
// комментарии к решению
// n без последней цифры == n%10
// n без предпоследней цифры == (n/100)*10 + n%10
func taskSolution(n int) int {
	ans := max(n, n/10)
	n = (n/100)*10 + n%10
	return max(ans, n)
}

func main() {
	var n int
	if _, err := fmt.Scan(&n); err != nil {
		panic(err)
	}

	fmt.Println(taskSolution(n))
}

package main

import "fmt"

func main() {
	var n int64
	fmt.Scan(&n)
	secondDigit := n / 10
	firstDigit := n / 100 * 10 + n % 10
	if firstDigit >= secondDigit && firstDigit >= n {
		fmt.Printf("%d", firstDigit)
	}else if secondDigit >= firstDigit && secondDigit >= n {
		fmt.Printf("%d", secondDigit)
	}else {
		fmt.Printf("%d", n)
	}
}

package main
import "fmt"

func main(){
	var s string
	fmt.Scan(&s)
	if s[0]!='-' {
		fmt.Print(s)
		return
	}
	n:=len(s)
	if (n==3) && (s[0]=='-') && (s[2]=='0') {
		fmt.Print(0)
		return
	}

	if s[n-1]<s[n-2]{
		fmt.Printf("%s%s\n",s[:n-2],s[n-1:])
	} else {
		fmt.Print(s[:n-1])
		fmt.Println()
	}
}

package main

import "fmt"

func main() {
	var n int64
	fmt.Scan(&n)
	secondDigit := n / 10
	firstDigit := n / 100 * 10 + n % 10

	if firstDigit > secondDigit && firstDigit > n {
		fmt.Printf("%d", firstDigit)
	}else if secondDigit > firstDigit && secondDigit > n {
		fmt.Printf("%d", secondDigit)
	}else {
		fmt.Printf("%d", n)
	}
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scanf("%d\n", &n)
	if n < 0 {
		n = -n
		steplast := (n / 10) % 10
		if steplast == 0 {
			n = n / 10
		} else {
			n = n%10 + (n/100)*10
		}
		n = -n
	}
	fmt.Print(n)
}

package main

import "fmt"

func main() {
    var s string
    fmt.Scan(&s)
    if s[0] == '-' {
        del := 1
        for i := 1; i < len(s); i++ {
            if s[del] < s[i] { del = i }
        }
        ans := 0
        for i := 1; i < len(s); i++ {
            if i != del { ans = (ans*10) + int(s[i]-'0') }
        }
        fmt.Println(-ans)
    } else {
        fmt.Println(s)
    }
}

package main

import "fmt"

func main() {
	var n int64
	fmt.Scan(&n)
	secondDigit := n / 10
	firstDigit := n / 100 * 10 + n % 10
	fmt.Println(n, firstDigit, secondDigit)
	if firstDigit >= secondDigit && firstDigit >= n {
		fmt.Printf("%d", firstDigit)
	}else if secondDigit >= firstDigit && secondDigit >= n {
		fmt.Printf("%d", secondDigit)
	}else {
		fmt.Printf("%d", n)
	}
}


package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _, _ := reader.ReadLine()
	//n := strings.Split(string(input), " ")

	times, _ := strconv.Atoi(string(input))

	a := make(map[byte]int)

	for i := 0; i < times; i++ {
		inp, _, _ := reader.ReadLine()
		integer, _ := strconv.Atoi(string(inp))
		_, ok := a[byte(integer)]
		if ok {
			a[byte(integer)]++
		} else {
			a[byte(integer)] = 0
		}
	}

	if len(a)!= 2 {
		fmt.Println("No")
		os.Exit(0)
	}

	var arr [2]int
	i := 0
	for _, v := range a {
		arr[i] = v
		i++
	}
	if arr[0] != arr[1] {
		fmt.Println("No")
	} else {
		fmt.Println("Yes")
		for key := range a {
			fmt.Print(key, " ")
		}
		fmt.Println()
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]int)
	last := -1
	for i := 0; i < n; i++ {
		var a int
		fmt.Scan(&a)
		m[a]++
		last = a
	}
	if len(m) != 2 || m[last] != n/2 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
		delete(m, last)
		other := 0
		for other = range m {
			break
		}
		fmt.Println(last, other)
	}
}

package main

import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
)

func main() {
	bs, _ := ioutil.ReadAll(os.Stdin)
	reader := bytes.NewBuffer(bs)

	var n, p, count int
	fmt.Fscanf(reader, "%d\n", &n)
	m := map[int]int{}
	for i := 0; i < n; i++ {
		fmt.Fscanf(reader, "%d\n", &p)
		c, ok := m[p]
		if ok {
			m[p] = c + 1
			count = c + 1
		} else {
			m[p] = 1
			count = 1
		}
	}
	if len(m) != 2 {
		fmt.Printf("NO")
		return
	} else {
		ans := make([]int, 0, 2)
		for k, v := range m {
			if v == count {
				ans = append(ans, k)
			} else {
				fmt.Printf("NO")
				return
			}
		}
		fmt.Printf("YES\n%d %d\n", ans[0], ans[1])
	}
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	cards := make([]int, n)
	for i := range cards {
		fmt.Scan(&cards[i])
	}

	m := make(map[int]int)
	for _, v := range cards {
		m[v]++
	}

	if len(m) != 2 {
		fmt.Println("NO")
		return
	}

	uniqueCards := make([]int, 0)
	for card := range m {
		uniqueCards = append(uniqueCards, card)
	}

	if m[uniqueCards[0]] == m[uniqueCards[1]] {
		fmt.Println("YES")
		fmt.Printf("%d %d\n", uniqueCards[0], uniqueCards[1])
	} else {
		fmt.Println("NO")
	}

}

package main

import "fmt"

func main() {
	var n, temp int
	var seen = make(map[int]int)
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scanln(&temp)
		seen[temp] += 1
	}
	if len(seen) != 2 {
		fmt.Println("NO")
	} else {
		var keys []int
		var vals []int
		for k, v := range seen {
			keys = append(keys, k)
			vals = append(vals, v)
		}
		if vals[0] == vals[1] {
			fmt.Println("YES")
			for _, k := range keys {
				fmt.Printf("%d ", k)
			}
		} else {
			fmt.Println("NO")
		}
	}
}

// Codeforces helper functions
// 20 Jan 18
// samadhi

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const debug = false

func main() {
	reader := bufio.NewReader(os.Stdin)

	n := gsli(reader)[0]

	var m map[int]int
	m = make(map[int]int)

	for i := 0; i <= 100; i++ {
		m[i] = 0
	}

	for i := 0; i < n; i++ {
		cur := gsli(reader)[0]
		m[cur]++
	}

	for i, e := range m {
		for j, e2 := range m {
			if e == e2 && e != 0 && i != j && e+e2 == n {
				fmt.Printf("YES\n")
				fmt.Printf("%v %v", i, j)
				return
			}
		}
	}

	dbg("%v", m)

	fmt.Printf("NO")

}

// Input helpers

// If you don't pass in a reference to the reader, and just instantiate a new
// one every time, it will work locally, with IO typed at human-speed, but not
// on Codeforces.

// Get Space-separated Line as Strings
//
// Example input:
// 1 test 382.0
// Example output:
// ["1", "test", "382.0"]

func gsls(reader *bufio.Reader) (arr []string) {
	// Get a full line
	input, _ := reader.ReadString('\n')

	//Strip newline and return chars, if any
	input = strings.TrimSuffix(input, "\n")
	input = strings.TrimSuffix(input, "\r")

	// Split at the spaces into an array
	arr = strings.Split(input, " ")

	return
}

// Get Space-separated Line as Integers
// Any non-valid integers will be 0
//
// Example input:
// test 1 12.3 -117
// Example output:
// [0, 1, 0, -117]

func gsli(reader *bufio.Reader) (arr []int) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.Atoi(e)
		arr = append(arr, cur)
	}

	return
}

// Get Space-separated Line as 64-bit Floats
// Any non-valid floats will be 0
//
// Example input:
// test 128.328 12 -11.0
// Example output:
// [0, 128.328, 12, -11]

func gslf(reader *bufio.Reader) (arr []float64) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.ParseFloat(e, 64)
		arr = append(arr, cur)
	}

	return
}

// Math helpers

// Positve Modulo
// Returns x mod y, but always positive

func posMod(x, y int) int {
	return (x%y + y) % y
}

// Output helpers

func yes() {
	fmt.Println("Yes")
}

func no() {
	fmt.Println("No")
}

// Debug helpers

// From https://groups.google.com/forum/#!topic/golang-nuts/Qlxs3V77nss

func dbg(s string, a ...interface{}) {
	if debug {
		fmt.Printf(s, a...)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	n := readInt()
	v := make([]int, 101)
	for i := 0; i < n; i++ {
		v[readInt()]++
	}
	pos := 0
	cnt1 := 0
	cnt2 := 0
	res := make([]int, 0)
	total1 := 0
	total2 := 0
	for i := 0; i < len(v); i++ {
		if v[i] != 0 {
			res = append(res, i)
			if pos%2 == 0 {
				cnt1++
				total1 += v[i]
			} else {
				cnt2++
				total2 += v[i]
			}
			pos++
		}
	}
	if cnt1 == cnt2 && total1 == total2 && len(res) == 2 {
		fmt.Println("YES")
		for i := 0; i < len(res); i++ {
			if i > 0 {
				fmt.Print(" ")
			}
			fmt.Print(res[i])
		}
		fmt.Println()
	} else {
		fmt.Println("NO")
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

import (
        "fmt"
)

var num int
var temp int

func main() {
        fmt.Scan(&num)
        res := make(map[int]int)
        for i := 0; i < num; i++ {
                fmt.Scan(&temp)
                if num, ok := res[temp]; ok {
                        res[temp] = num + 1
                } else {
                        res[temp] = 1
                }
        }
        if len(res) != 2 || res[temp] != num/2 {
                fmt.Println("NO")
                return
        }
        pre := -1
        for key, _ := range res {
                if pre == -1 {
                        pre = key
                } else {
                        fmt.Printf("yes\n%d %d\n", pre, key)
                }
        }
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	numbers := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d\n", &numbers[i])
	}

	// sort
	sort.Ints(numbers)

	if numbers[0] == numbers[(N/2)-1] && numbers[(N/2)] == numbers[N-1] &&
		numbers[N-1] != numbers[0] {
		fmt.Println("YES")
		fmt.Printf("%d %d", numbers[0], numbers[N-1])
	} else {
		fmt.Println("NO")
	}
}

package main
import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	m := make(map[int]int)
	for i := 0 ; i < n ; i++ {
		var v int
		fmt.Scan(&v)
		m[v]++
	}
	if len(m) == 2 {
		cnt := 0
		var k1, k2 int
		for k, v := range m {
			if cnt == 0 {
				k1 = k
				cnt = v
			} else if cnt != v {
				fmt.Println("NO")
				return
			} else {
				k2 = k
			}
		}
		fmt.Println("YES")
		fmt.Println(k1, k2)
	} else {
		fmt.Println("NO")
	}
}

package main

import ("fmt")

func main(){
	var n int
	a := make(map[int]int)
	scan(&n)
	for i := 0; i < n; i++{
		var t int
		scan(&t)
		a[t]++
	}
	if len(a) > 2 || len(a) < 2{
		sout("NO")
		return
	}
	b := make(map[int]map[int]bool)
	for k,v := range a{
		if b[v] == nil {b[v] = make(map[int]bool)}
		b[v][k] = true
	}

	for _,v := range b{
		if (len(v) >= 2){
			sout("YES")
			t := 0
			for k,_ := range v{
				sout(k)
				if (t == 1){return}
				t++
			}
		}
	}
	sout("NO")
}

func scan(in ... interface{}){
	for _,k := range in{
		fmt.Scan(k)
	}
}

func sout(obj ... interface{}){
	for _, k := range obj{
		fmt.Print(k)
	}
	fmt.Println()
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var a [101]int
	for i := 0; i < n; i++ {
		var x int
		fmt.Scan(&x)
		a[x]++
	}
	for i := 1; i <= 100; i++ {
		for j := i + 1; j <= 100; j++ {
			if a[i] == a[j] && a[i] == n / 2 {
				fmt.Println("YES")
				fmt.Printf("%d %d\n", i, j)
				return
			}
		}
	}
	fmt.Println("NO")
}

package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	cards := make([]int, n)
	for i := range cards {
		fmt.Scan(&cards[i])
	}

	m := make(map[int]int)
	for _, v := range cards {
		m[v]++
	}

	if len(m) != 2 {
		fmt.Println("NO")
	} else {
		var en int
		for _, entries := range m {
			if en == 0 {
				en = entries
			}
			if entries != en {
				fmt.Println("NO")
				return
			}
		}
		fmt.Println("YES")
	}
}

package main

import "fmt"

func main() {
	var n, temp int
	var seen = make(map[int]bool)
	fmt.Scanln(&n)
	for i := 0; i < n; i++ {
		fmt.Scanln(&temp)
		seen[temp] = true
	}
	if len(seen) != 2 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
		for k, _ := range seen {
			fmt.Printf("%d ", k)
		}
	}
}

package main

import "fmt"

func main() {
	var n int
	var seen = make(map[int]bool)
	fmt.Scanf("%d", &n)
	var temp int
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &temp)
		seen[temp] = true
	}
	if len(seen) != 2 {
		fmt.Println("NO")
	} else {
		fmt.Println("YES")
		for k, _ := range seen {
			fmt.Printf("%d ", k)
		}
	}
}

// Codeforces helper functions
// 20 Jan 18
// samadhi

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

const debug = false

func main() {
	reader := bufio.NewReader(os.Stdin)

	n := gsli(reader)[0]

	var m map[int]int
	m = make(map[int]int)

	for i := 0; i <= 100; i++ {
		m[i] = 0
	}

	for i := 0; i < n; i++ {
		cur := gsli(reader)[0]
		m[cur]++
	}

	for i, e := range m {
		for j, e2 := range m {
			if e == e2 && e != 0 && i != j {
				fmt.Printf("YES\n")
				fmt.Printf("%v %v", i, j)
				return
			}
		}
	}

	dbg("%v", m)

	fmt.Printf("NO")

}

// Input helpers

// If you don't pass in a reference to the reader, and just instantiate a new
// one every time, it will work locally, with IO typed at human-speed, but not
// on Codeforces.

// Get Space-separated Line as Strings
//
// Example input:
// 1 test 382.0
// Example output:
// ["1", "test", "382.0"]

func gsls(reader *bufio.Reader) (arr []string) {
	// Get a full line
	input, _ := reader.ReadString('\n')

	//Strip newline and return chars, if any
	input = strings.TrimSuffix(input, "\n")
	input = strings.TrimSuffix(input, "\r")

	// Split at the spaces into an array
	arr = strings.Split(input, " ")

	return
}

// Get Space-separated Line as Integers
// Any non-valid integers will be 0
//
// Example input:
// test 1 12.3 -117
// Example output:
// [0, 1, 0, -117]

func gsli(reader *bufio.Reader) (arr []int) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.Atoi(e)
		arr = append(arr, cur)
	}

	return
}

// Get Space-separated Line as 64-bit Floats
// Any non-valid floats will be 0
//
// Example input:
// test 128.328 12 -11.0
// Example output:
// [0, 128.328, 12, -11]

func gslf(reader *bufio.Reader) (arr []float64) {
	stringArr := gsls(reader)

	for _, e := range stringArr {
		cur, _ := strconv.ParseFloat(e, 64)
		arr = append(arr, cur)
	}

	return
}

// Math helpers

// Positve Modulo
// Returns x mod y, but always positive

func posMod(x, y int) int {
	return (x%y + y) % y
}

// Output helpers

func yes() {
	fmt.Println("Yes")
}

func no() {
	fmt.Println("No")
}

// Debug helpers

// From https://groups.google.com/forum/#!topic/golang-nuts/Qlxs3V77nss

func dbg(s string, a ...interface{}) {
	if debug {
		fmt.Printf(s, a...)
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	n := readInt()
	v := make([]int, 101)
	for i := 0; i < n; i++ {
		v[readInt()]++
	}
	pos := 0
	cnt1 := 0
	cnt2 := 0
	res := make([]int, 0)
	for i := 0; i < len(v); i++ {
		if v[i] != 0 {
			res = append(res, i)
			if pos%2 == 0 {
				cnt1++
			} else {
				cnt2++
			}
			pos++
		}
	}
	if cnt1 == cnt2 {
		fmt.Println("YES")
		for i := 0; i < len(res); i++ {
			if i > 0 {
				fmt.Print(" ")
			}
			fmt.Print(res[i])
		}
		fmt.Println()
	} else {
		fmt.Println("NO")
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func solve() {
	n := readInt()
	v := make([]int, 101)
	for i := 0; i < n; i++ {
		v[readInt()]++
	}
	pos := 0
	cnt2 := 0
	cnt1 := 0
	total2 := 0
	total1 := 0
	res := make([]int, 0)
	for i := 0; i < len(v); i++ {
		if v[i] != 0 {
			res = append(res, i)
			if pos%2 == 0 {
				cnt1++
				total1 += v[i]
			} else {
				total2 += v[i]
				cnt2++
			}
			pos++
		}
	}
	if cnt1 == cnt2 && total1 == total2 {
		fmt.Println("YES")
		for i := 0; i < len(res); i++ {
			if i > 0 {
				fmt.Print(" ")
			}
			fmt.Print(res[i])
		}
		fmt.Println()
	} else {
		fmt.Println("NO")
	}
}

var scanner *bufio.Scanner

func main() {
	scanner = bufio.NewScanner(os.Stdin)
	const MaxTokenLength = 1024 * 1024
	scanner.Buffer(make([]byte, 0, MaxTokenLength), MaxTokenLength)
	scanner.Split(bufio.ScanWords)
	solve()
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

// IO

func readString() string {
	scanner.Scan()
	return scanner.Text()
}

func readInt() int {
	val, _ := strconv.Atoi(readString())
	return val
}

func readInt64() int64 {
	v, _ := strconv.ParseInt(readString(), 10, 64)
	return v
}

func readIntArray(sz int) []int {
	a := make([]int, sz)
	for i := 0; i < sz; i++ {
		a[i] = readInt()
	}
	return a
}

func readInt64Array(n int) []int64 {
	res := make([]int64, n)
	for i := 0; i < n; i++ {
		res[i] = readInt64()
	}
	return res
}

package main

import (
        "fmt"
)

var num int
var temp int

func main() {
        fmt.Scan(&num)
        res := make(map[int]int)
        for i := 0; i < num; i++ {
                fmt.Scan(&temp)
                if num, ok := res[temp]; ok {
                        res[temp] = num + 1
                } else {
                        res[temp] = 1
                }
        }
        if len(res) != 2 {
                fmt.Println("NO")
                return
        }
        pre := -1
        for key, _ := range res {
                if pre == -1 {
                        pre = key
                } else {
                        fmt.Printf("yes\n%d %d\n", pre, key)
                }
        }
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scanf("%d", &N)
	numbers := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d", &numbers[i])
	}

	// sort
	sort.Ints(numbers)

	if numbers[0] == numbers[(N/2)-1] && numbers[(N/2)] == numbers[N-1] &&
		numbers[N-1] != numbers[0] {
		fmt.Println("YES")
		fmt.Printf("%d %d", numbers[0], numbers[N-1])
	} else {
		fmt.Println("NO")
	}
}

package main

import (
	"fmt"
	"sort"
)

func main() {
	var N int
	fmt.Scanf("%d\n", &N)
	numbers := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scanf("%d\n", &numbers[i])
	}

	// sort
	sort.Ints(numbers)
	fmt.Println("Numbers")
	fmt.Println(numbers)

	if numbers[0] == numbers[(N/2)-1] && numbers[(N/2)] == numbers[N-1] &&
		numbers[N-1] != numbers[0] {
		fmt.Println("YES")
		fmt.Printf("%d %d", numbers[0], numbers[N-1])
	} else {
		fmt.Println("NO")
	}
}

package main

import ("fmt")

func main(){
	var n int
	a := make(map[int]int)
	scan(&n)
	for i := 0; i < n; i++{
		var t int
		scan(&t)
		a[t]++
	}
	if len(a) > 2 || len(a) < 2{
		sout("NO")
		return
	}
	b := make(map[int]map[int]bool)
	for k,v := range a{
		if b[v] == nil {b[v] = make(map[int]bool)}
		b[v][k] = true
	}

	for _,v := range b{
		if (len(v) >= 2){
			sout("YES")
			t := 0
			for k,_ := range v{
				sout(k)
				if (t == 1){return}
				t++
			}
		}
	}
	sout("NO")
}

func scan(in ... interface{}){
	for _,k := range in{
		fmt.Scan(k)
	}
}

func sout(obj ... interface{}){
	for _, k := range obj{
		fmt.Print(k, " ")
	}
	fmt.Println()
}

package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var a [101]int
	for i := 0; i < n; i++ {
		var x int
		fmt.Scan(&x)
		a[x]++
	}
	for i := 1; i <= 100; i++ {
		for j := i + 1; j <= 100; j++ {
			if a[i] == a[j] && a[i] > 0 {
				fmt.Println("YES")
				fmt.Printf("%d %d\n", i, j)
				return
			}
		}
	}
	fmt.Println("NO")
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func sortAsc(numbers string) (result string) {
	splitResult := strings.Split(numbers, "+")
	if len(splitResult) <= 1 {
		result = numbers
		return
	}

	var index int
	var isSwap bool
	for {
		if splitResult[index] > splitResult[index+1] {
			temp := splitResult[index]
			splitResult[index] = splitResult[index+1]
			splitResult[index+1] = temp
			isSwap = true
		}

		index++
		if index == len(splitResult)-1 {
			index = 0
			if !isSwap {
				break
			}
			isSwap = false
		}
	}

	var sb strings.Builder
	for i, number := range splitResult {
		sb.WriteString(number)
		if i < len(splitResult)-1 {
			sb.WriteString("+")
		}
	}

	return sb.String()
}

func main() {

	// var firstWord, secondWord string
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		if err := scanner.Err(); err != nil {
			panic(err)
		}

		fmt.Println(sortAsc(scanner.Text()))

		// if firstWord == "" {
		// 	firstWord = scanner.Text()
		// 	continue
		// }

		// if secondWord == "" {
		// 	secondWord = scanner.Text()
		// 	fmt.Println(compareString(firstWord, secondWord))
		// 	firstWord, secondWord = "", ""
		// }
	}
}

//A. Математика спешит на помощь
package main

import (
	"fmt"
	s "strings"
)

func main() {
	var line, rez string

	var cnt1, cnt2, cnt3 int

	fmt.Scan(&line)
	/*	for i := 0; i < len(line); i += 2 {
			if string([]rune(line)[i]) == "1" {
				cnt1++
				continue
			} else if string([]rune(line)[i]) == "2" {
				cnt2++
				continue
			} else {
				cnt3++
			}
		}
	*/
	cnt1 = s.Count(line, "1")
	cnt2 = s.Count(line, "2")
	cnt3 = s.Count(line, "3")

	for i := 0; i < cnt1; i++ {
		rez += "1+"
	}
	for i := 0; i < cnt2; i++ {
		rez += "2+"
	}
	for i := 0; i < cnt3; i++ {
		rez += "3+"
	}

	rez = rez[:len(rez)-1]
	fmt.Println(rez)
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	ss := strings.Split(s, "+")
	sort.Strings(ss)
	fmt.Println(strings.Join(ss, "+"))
}

package main
import(
	"fmt"
	"sort"
	"strings"
)
func main() {
	var i string
	fmt.Scan(&i)
	result := strings.Split(i, "+")
	sort.Sort(sort.StringSlice(result))//sort the array
	s := []string{}
	for _,element := range result{
			s=append(s, element)
			s=append(s,"+")
		}
	result1 := strings.Join(s, "")
    	fmt.Println(result1[:len(s)-1])
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strings"
)

// HelpfulSum sorts numbers in a string in non-increasing order.
func HelpfulSum(s string) string {
	nums := strings.Split(s, "+")
	sort.StringSlice(nums).Sort()
	return strings.Join(nums, "+")
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	fmt.Println(HelpfulSum(scanner.Text()))
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strings"
)

var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	defer writer.Flush()

	var s string
	scanf("%s\n", &s)
	arr := strings.Split(s, "+")
	sort.Strings(arr)
	for i, v := range arr {
		if i < len(arr)-1 {
			printf("%s+", v)
		} else {
			printf("%s", v)
		}
	}
	printf("\n")
}

/*
Helpful Maths
time limit per test2 seconds
memory limit per test256 megabytes
inputstandard input
outputstandard 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.

Sample test(s)
input
3+2+1
output
1+2+3
input
1+1+3+1+3
output
1+1+1+3+3
input
2
output
2
*/

package main

import (
	"fmt"
	"sort"
)

func main () {
	var (
		str string
		ints = make([]int, 0, 5)
	)
	fmt.Scanf("%s", &str)
	for _, rune := range str {
		switch rune {
		case '1':
			ints = append(ints, 1)
		case '2':
			ints = append(ints, 2)
		case '3':
			ints = append(ints, 3)
		}
	}
	sort.Ints(ints)
	var result string
	end := len(ints) - 1
	for i, v := range ints {
		result += fmt.Sprintf("%d", v)
		if i != end {
			result += "+"
		}
	}
	fmt.Println(result)
}

package main

import(
	"fmt"

)

func main(){
	var s string

	var a [5]int

	fmt.Scan(&s)

	n := len(s)
	for i:= 0 ; i < n ; i ++ {
		if s[i] != '+' {
		//	fmt.Println(int(s[i]) - int('0'))
			a[int(s[i]) - int('0')] ++
		}
	}

	var notFirst bool
	sol := ""
	for i := 1 ; i <= 3 ; i ++ {
		for j := 0 ; j < a[i] ; j ++ {
			if notFirst {
				sol = sol + "+"
			}

			notFirst = true
		//	fmt.Println(string(i+int('0')))
			sol = sol + string(i+int('0'))
		}
	}

	fmt.Printf("%s",sol)
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var str string
	fmt.Scanln(&str)

	num := strings.Split(str, "+")
	sort.Strings(num)
	fmt.Println(strings.Join(num, "+"))
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

type rawnums []string

func (a rawnums) Len() int           { return len(a) }
func (a rawnums) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }
func (a rawnums) Less(i, j int) bool { return a[i] < a[j] }

func main() {

	var s string
	fmt.Scan(&s)
	nums := strings.Split(s, "+")
	sort.Sort(rawnums(nums))
	fmt.Println(strings.Join(nums, "+"))

}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {

	var s string
	fmt.Scan(&s)
	nums := strings.Split(s, "+")
	sort.Strings(nums)
	fmt.Println(strings.Join(nums, "+"))

}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	slice := strings.Split(s, "+")
	sort.Strings(slice)
	str := strings.Join(slice, "+")
	fmt.Println(str)
}

package main

import (
	"fmt"
	"sort"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)
	var arr []int
	for i := 0; i < len(s); i++ {
		if s[i] >= '1' && s[i] <= '3' {
			n, _ := strconv.Atoi(string(s[i]))
			arr = append(arr, n)
		}
	}
	sort.Ints(arr)
	for i := 0; i < len(arr)-1; i++ {
		fmt.Print(arr[i])
		fmt.Print("+")
	}
	fmt.Print(arr[len(arr)-1])
}

package main

import "fmt"

func main() {
    var s string
    var a [105]int
    fmt.Scan(&s)
    n := 0
    for i := 0; i < len(s); i += 2 {
        a[n] = int(s[i])
        n++
    }
    for i := n-1; i > 0; i-- {
        m := i
        for j := 0; j < i; j++ {
            if a[j] > a[m] { m = j }
        }
        a[m], a[i] = a[i], a[m]
    }
    for i := 0; i < n; i++ {
        fmt.Print(string(a[i]))
        if (i == (n-1)) { fmt.Println() } else { fmt.Print("+") }
    }
}

package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	var a, b, c int
	// ans := make(map[int]int)
	for _, x := range s {
		if x == '1' {
			a++
			// ans[1]++
		} else if x == '2' {
			b++
			// ans[2]++
		} else if x == '3' {
			c++
			// ans[3]++
		}
	}
	// fmt.Println(len(ans))
	for a+b+c > 0 {
		// fmt.Println(a + b + c)
		if a > 0 {
			fmt.Print(1)
			a--
		} else if b > 0 {
			fmt.Print(2)
			b--
		} else if c > 0 {
			fmt.Print(3)
			c--
		}
		if a+b+c > 0 {
			fmt.Print("+")
		}
	}
}

package main

import (
	"fmt"
	"sort"
	"strconv"
)

func main() {
	var p string
	fmt.Scanf("%s\n", &p)

	numbers := make([]int, 0)

	for i := 0; i < len(p); i++ {
		if p[i] != '+' {
			n, _ := strconv.Atoi(string(p[i]))
			numbers = append(numbers, n)
		}
	}
	sort.Ints(numbers)
	fmt.Print(numbers[0])
	for i := 1; i < len(numbers); i++ {
		fmt.Print("+" + strconv.Itoa(numbers[i]))
	}
}

package main

import (
        "fmt"
        "strings"
        _"strconv"
        "sort"
)

func main() {
        var a string
        var b string
        fmt.Scanln(&a)
        strArray := strings.Split(a, "+")
        sort.Strings(strArray)
        len := len(strArray)
        for i:=0; i < len -1; i++ {
                b += strArray[i]
                b += "+"
        }
        b += strArray[len - 1]
        fmt.Println(b)
}

package main

import (
    "fmt"
    )

func main() {
    var line string
    fmt.Scan(&line)

    var count = [4]int{0}
    for i := 0; i < len(line); i++ {
        if line[i] != '+' {
            count[line[i] - '0']++
        }
    }

    var result string = ""
    for i := 1; i <= 3; i++ {
        for j := 0; j < count[i]; j++ {
            result += string(i + '0')
            result += "+"
        }
    }

    result = result[:len(result) - 1]
    fmt.Println(result)
}

//  URL: http://codeforces.com/problemset/problem/339/A
//  ~ Basic Implementation Problem

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strings"
)

func main() {
	reader, writer := bufio.NewReader(os.Stdin), bufio.NewWriter(os.Stdout)
	defer writer.Flush()
	var s string
	fmt.Fscanf(reader, "%s\n", &s)
	stringArray := strings.Split(s, "+")
	sort.Strings(stringArray)
	fmt.Fprintf(writer, "%s\n", strings.Join(stringArray, "+"))
}

package main

import (
    "fmt"
    "strings"
    "sort"
)

func main() {
    var s string
    fmt.Scan(&s)
    sArr := strings.Split(s, "+")
    sort.Strings(sArr)
    fmt.Println(strings.Join(sArr, "+"))
}

// olymp
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	digs := strings.Split(s, "+")
	sort.StringSlice(digs).Sort()
	fmt.Println(strings.Join(digs, "+"))
}

// olymp
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func merge(l, r []int) []int {
	var ret []int
	var i, j int
	for i, j = 0, 0; i < len(l) && j < len(r); {
		if l[i] < r[j] {
			ret = append(ret, l[i])
			i++
		} else {
			ret = append(ret, r[j])
			j++
		}
	}
	if i < len(l) {
		ret = append(ret, l[i:]...)
	}
	if j < len(r) {
		ret = append(ret, r[j:]...)
	}
	return ret
}

func sort(ls []int) []int {
	if len(ls) < 2 {
		return ls
	}
	n := len(ls)
	m := n / 2
	return merge(sort(ls[:m]), sort(ls[m:]))
}

func smap(ls []int, f func(int) string) []string {
	var ret []string
	for _, v := range ls {
		ret = append(ret, f(v))
	}
	return ret
}

func main() {
	var x int
	fmt.Scanf("%d", &x)
	var ls []int
	ls = append(ls, x)
	for {
		n, err := fmt.Scanf("%d", &x)
		if n == 0 || err != nil {
			break
		}
		ls = append(ls, x)
	}
	fmt.Println(strings.Join(smap(sort(ls), strconv.Itoa), "+"))
}

package main

import "fmt"

func main() {
	var c byte
	var s string
	var count [3]int
	for {
		fmt.Scanf("%c", &c)
		if c == '\n' {
			break
		}
		switch c {
		case '1':
			count[0]++
		case '2':
			count[1]++
		case '3':
			count[2]++
		case '+':
			continue
		}
	}
	for i := count[0]; i > 0; i-- {
		s = s + "1+"
	}
	for i := count[1]; i > 0; i-- {
		s = s + "2+"
	}
	for i := count[2]; i > 0; i-- {
		s = s + "3+"
	}
	fmt.Println(s[:len(s)-1])
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	scanner.Scan()
	str := scanner.Text()
	val, _ := strconv.Atoi(str)
	return val
}

func nextFloat() float64 {
	scanner.Scan()
	str := scanner.Text()
	val, _ := strconv.ParseFloat(str, 64)
	return val
}

func nextString() string {
	scanner.Scan()
	str := scanner.Text()
	return str
}

func main() {
	scanner.Split(bufio.ScanWords)
	str := nextString()
	cnt := make(map[rune]int)
	for _, c := range str {
		if c != '+' {
			cnt[c]++
		}
	}
	for i := 0; i < (len(str)+1)/2; i++ {
		if i != 0 {
			fmt.Print("+")
		}
		switch {
		case cnt['1'] > 0:
			fmt.Print("1")
			cnt['1']--

		case cnt['2'] > 0:
			fmt.Print("2")
			cnt['2']--

		case cnt['3'] > 0:
			fmt.Print("3")
			cnt['3']--
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var str string
	fmt.Scan(&str)

	var arr = make([]int, 4)
	for i := 1; i <= 3; i++ {
		arr[i] = strings.Count(str, string(rune(i+48)))
	}

	var ret = make([]string, 0)
	for i := 1; i <= 3; i++ {
		for j := 1; j <= arr[i]; j++ {
			ret = append(ret, string(rune(i+48)))
		}
	}

	fmt.Println(strings.Join(ret, "+"))
}

package main

import (
	"fmt"
	"log"
    "strings"
    "sort"
)

func main() {
	A:=""
  _, err := fmt.Scanf("%s", &A)
  b:=strings.Split(A,"+")

	if err !=nil{
		log.Fatal(err)
  }
  sort.Strings(b)
  A=b[0]
  for x:=1; x<len(b);x++{
      A += "+" + b[x]
  }
  fmt.Print(A)

}

package main

import (
	"bytes"
	"fmt"
)

func main() {
	var s string
	fmt.Scan(&s)
	n1, n2, n3 := 0, 0, 0
	for i := 0; i < len(s); i += 2 {
		switch s[i] {
		case '1':
			n1++
		case '2':
			n2++
		case '3':
			n3++
		}
	}
	var buffer bytes.Buffer
	for i := 0; i < n1; i++ {
		buffer.WriteRune('1')
		if i != n1-1 {
			buffer.WriteByte('+')
		}
	}
	if n1 > 0 && n2 > 0 {
		buffer.WriteRune('+')
	}
	for i := 0; i < n2; i++ {
		buffer.WriteRune('2')
		if i != n2-1 {
			buffer.WriteByte('+')
		}
	}
	if n2 > 0 && n3 > 0 || n1 > 0 && n3 > 0 {
		buffer.WriteRune('+')
	}
	for i := 0; i < n3; i++ {
		buffer.WriteRune('3')
		if i != n3-1 {
			buffer.WriteByte('+')
		}
	}
	fmt.Print(buffer.String())
}

// https://codeforces.com/problemset/problem/339/A
package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var problem string
	fmt.Scanf("%v\n", &problem)
	numbers := strings.Split(problem, "+")
	sort.Slice(numbers, func(i, j int) bool {
		return numbers[i] < numbers[j]
	})
	fmt.Printf("%v", strings.Join(numbers, "+"))
}

package main

import (
  "fmt"
  "strconv"
)

func main() {
  var s string
  var ar [3]int
  fmt.Scanf("%s", &s)
  for i:=0; i < len(s) ; i=i+2 {
    switch(s[i]) {
      case '1':
        ar[0]++
        break
      case '2':
        ar[1]++
        break
      case '3':
        ar[2]++
        break
    }
  }

  sum := ""
  for i:=0; i < 3; i++ {
    for j:=0; j < ar[i]; j++ {
      if len(sum) == 0 {
        sum += strconv.Itoa(i+1)
      } else {
        sum += "+"
        sum += strconv.Itoa(i+1)
      }
    }
  }

  fmt.Println(sum)
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	nums := strings.Split(s, "+")
	if sort.StringsAreSorted(nums) {
		fmt.Println(s)
		return
	}
	sort.Strings(nums)
	fmt.Println(strings.Join(nums, "+"))
}

package main

import "fmt"
import "sort"
import "strings"
import "strconv"

func main() {
    var result string
    var equation string
    var equation_variables []int
    fmt.Scanf("%s", &equation)

    for _, element := range strings.Split(equation, "+") {
        number, _ := strconv.Atoi(element)
        equation_variables = append(equation_variables, number)
    }

    sort.Sort(sort.IntSlice(equation_variables))

    for _, element := range equation_variables {
        result = result + strconv.Itoa(element) + "+"
    }

    fmt.Println(strings.TrimSuffix(result, "+"))
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	summands := strings.Split(s, "+")
	sort.Strings(summands)
	fmt.Println(strings.Join(summands, "+"))
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	s1 := strings.Builder{}
	s2 := strings.Builder{}
	s3 := strings.Builder{}
	s1.Grow(100)
	s2.Grow(100)
	s3.Grow(100)
	input := ""
	fmt.Scanf("%s\n", &input)
	for _, c := range input {
		switch c {
		case '1':
			s1.WriteString("1+")
		case '2':
			s2.WriteString("2+")
		case '3':
			s3.WriteString("3+")
		}
	}
	ans := s1.String() + s2.String() + s3.String()
	fmt.Println(ans[:len(ans)-1])
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	scanner.Scan()
	sum := scanner.Text()

	parts := strings.Split(sum, "+")
	sort.Strings(parts)

	fmt.Println(strings.Join(parts, "+"))
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	s1 := strings.Builder{}
	s2 := strings.Builder{}
	s3 := strings.Builder{}
	s1.Grow(100)
	s2.Grow(100)
	s3.Grow(100)
	input := ""
	fmt.Scanf("%s\n", &input)
	for _, c := range input {
		switch c {
		case '1':
			s1.WriteString("1+")
		case '2':
			s2.WriteString("2+")
		case '3':
			s3.WriteString("3+")
		}
	}
	out := strings.Builder{}
	out.Grow(3 * 100)
	out.WriteString(s1.String())
	out.WriteString(s2.String())
	out.WriteString(s3.String())
	ans := out.String()
	fmt.Println(ans[:len(ans)-1])
	//ans := s1.String() + s2.String() + s3.String()
	//fmt.Println(ans[:len(ans)-1])
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var s string
	fmt.Scanln(&s)
	fields := strings.Split(s, "+")
	sort.Sort(sort.StringSlice(fields))
	fmt.Println(strings.Join(fields, "+"))
}

package main

import "fmt"

func main() {
	cnt := []int{0, 0, 0}
	var b []byte
	fmt.Scan(&b)
	for i := len(b) - 1; i >= 0; i -= 2 {
		cnt[b[i]-'1']++
	}
	i, c := 0, byte('1')
	for _, n := range cnt {
		for ; n > 0; n-- {
			b[i] = c
			i += 2
		}
		c++
	}
	fmt.Println(string(b))
}

package main

import (
	"fmt"
	"sort"
	"strconv"
	"strings"
)

func main() {
	var istring string
	_, _ = fmt.Scanln(&istring)
	xstring := strings.Split(istring, "+")
	var numArray []int
	for i := 0; i < len(xstring); i++ {
		inumber, _ := strconv.Atoi(xstring[i])
		numArray = append(numArray, inumber)
	}
	sort.Ints(numArray)
	for i := 0; i < len(numArray); i++ {
		if i == len(numArray)-1 {
			fmt.Print(numArray[i])
		} else {
			fmt.Printf("%d+", numArray[i])
		}
	}
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var line string
	_, _ = fmt.Scan(&line)

	summands := strings.Split(line, "+")

	var n1s, n2s, n3s int
	for _, summand := range summands {
		if summand == "1" {
			n1s++
		} else if summand == "2" {
			n2s++
		} else if summand == "3" {
			n3s++
		}
	}

	for i := 0; i < n1s; i++ {
		summands[i] = "1"
	}
	for i := 0; i < n2s; i++ {
		summands[n1s+i] = "2"
	}
	for i := 0; i < n3s; i++ {
		summands[n1s+n2s+i] = "3"
	}

	fmt.Print(strings.Join(summands, "+"))
}

package main

import (
	"bytes"
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var hashArray [3]int
	var input string
	fmt.Scanln(&input)
	numbers := strings.Split(input, "+")
	for i := 0; i < len(numbers); i++ {
		if num, err := strconv.Atoi(numbers[i]); err == nil {
			hashArray[num-1]++
		}
	}
	var output bytes.Buffer
	for index := 0; index < 3; index++ {
		for i := 0; i < hashArray[index]; i++ {
			output.WriteString(strconv.Itoa(index + 1))
			output.WriteString("+")
		}
	}
	fmt.Print(strings.TrimRight(output.String(), "+"))
}

package main
import "fmt"
import "strings"

func main()  {
  var input string
  fmt.Scan(&input)
  var output string

  rakams := strings.Split(input,"+")
  numof1 := 0
  numof2 := 0
  numof3 := 0

  for i := range rakams {
    if rakams[i] == "1" {
      numof1 += 1
    }else if rakams[i] == "2" {
      numof2 += 1
    }else if rakams[i] == "3" {
      numof3 += 1
    }
  }
  for i := 0; i < numof1; i++ {
    output += "1+"
  }
  for i := 0; i < numof2; i++ {
    output += "2+"
  }
  for i := 0; i < numof3; i++ {
    output += "3+"
  }
  output = output[:len(output)-1]
  fmt.Println(output)

}

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	counts := make([]string, 3)
	for _, key := range scanner.Text() {
		if key == '+' {
			continue
		}
		counts[key - '0' - 1] += string(key) + "+"
	}

	var str string
	for _, s := range counts {
		str += s
	}

	fmt.Println(str[:len(str) - 1])

}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var line string
	_, _ = fmt.Scan(&line)

	summands := strings.Split(line, "+")

	sort.Strings(summands)
	fmt.Print(strings.Join(summands, "+"))
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"strconv"
	"os"
	"strings"
	"sort"
)

func main() {
    defer s.Flush()

	sp := strings.Split(s.NextLine(), "+")
	sort.Strings(sp)
	s.Println(strings.Join(sp, "+"))
}

var (
	s *InOut
)

func init() {
	s = NewInOut(os.Stdin, os.Stdout)
}

type InOut struct {
	*bufio.Reader
	*bufio.Writer
}

func NewInOut(r io.Reader, w io.Writer) *InOut {
	return &InOut{bufio.NewReader(r), bufio.NewWriter(w)}
}

// Get Next Integer
func (s *InOut) Next() (r int) {
	b, _ := s.ReadByte()
	p := 1
	for (b < '0' || '9' < b) && b != '-' {
		b, _ = s.ReadByte()
	}
	if b == '-' {
		p = -1
		b, _ = s.ReadByte()
	}
	for '0' <= b && b <= '9' {
		r = 10*r + int(b-'0')
		b, _ = s.ReadByte()
	}
	return r * p
}

func (s *InOut) NextInt64() (r int64) {
	b, _ := s.ReadByte()
	p := int64(1)
	for (b < '0' || '9' < b) && b != '-' {
		b, _ = s.ReadByte()
	}
	if b == '-' {
		p = -1
		b, _ = s.ReadByte()
	}
	for '0' <= b && b <= '9' {
		r = 10*r + int64(b-'0')
		b, _ = s.ReadByte()
	}
	return r * p
}

// Get Next Line String
func (s *InOut) NextLine() (r string) {
	b, _ := s.ReadByte()
	for b == '\r' || b == '\n' {
		b, _ = s.ReadByte()
	}
	buf := make([]byte, 0)
	for ; b != '\r' && b != '\n'; b, _ = s.ReadByte() {
		buf = append(buf, b)
	}
	return string(buf)
}

// Get Next String using delimiter whitespace
func (s *InOut) NextStr() (r string) {
	return string(s.NextBytes())
}

// Get Next String using delimiter whitespace
func (s *InOut) NextBytes() (r []byte) {
	b, _ := s.ReadByte()
	for b == '\r' || b == '\n' || b == ' ' {
		b, _ = s.ReadByte()
	}
	buf := make([]byte, 0)
	for ; b != '\r' && b != '\n' && b != ' '; b, _ = s.ReadByte() {
		buf = append(buf, b)
	}
	return buf
}

// Print Strings using the suitable way to change type
func (s *InOut) Print(os ...interface{}) {
	for _, o := range os {
		switch o.(type) {
		case byte:
			s.WriteByte(o.(byte))
		case string:
			s.WriteString(o.(string))
		case int:
			s.WriteString(strconv.Itoa(o.(int)))
		case int64:
			s.WriteString(strconv.FormatInt(o.(int64), 10))
		default:
			s.WriteString(fmt.Sprint(o))
		}
	}
}

// Print Strings using the suitable way to change type with new line
func (s *InOut) Println(os ...interface{}) {
	for _, o := range os {
		s.Print(o)
	}
	s.Print("\n")
}

// Print immediately with new line (for debug)
func (s *InOut) PrintlnNow(o interface{}) {
	fmt.Println(o)
}

package main

import(
    "fmt"
    "sort"
)

func main(){
    var(
        s string
        arr = []int{}
    )
    fmt.Scan(&s)
    for i:=0;i<len(s);i++{
        if s[i]!=43{
            arr = append(arr,int(s[i]-48))
        }
    }
    sort.Ints(arr)
    for i:=0;i<len(arr)-1;i++{
        fmt.Print(arr[i],"+")
    }
    fmt.Println(arr[len(arr)-1])
}

package main

import "fmt"
import "bytes"
import "io/ioutil"
import "os"

func task_solution(line []byte) string {
	count := []int{0, 0, 0}
	for _, b := range line {
		if b != '+' {
			count[b-'1'] += 1
		}
	}
	// slices do not copy
	// this may corrupt input data
	// but noone cares
	ans := line
	for i, curr := 0, 0; i < len(count); i += 1 {
		j := 0
		if curr == 0 && count[i] > 0 {
			ans[curr] = byte(i) + '1'
			curr = 1
			j = 1
		}
		for ; j < count[i]; j += 1 {
			ans[curr] = '+'
			ans[curr+1] = byte(i) + '1'
			curr += 2
		}
	}

	return string(ans)
}

func main() {
	in_raw, err := ioutil.ReadAll(os.Stdin)
	if err != nil {
		panic(err)
	}

	fmt.Println(task_solution(bytes.TrimSpace(in_raw)))
}

// Author: sighduck
// URL: https://codeforces.com/problemset/problem/339/A

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strings"
)

func Solve(s string) string {
	numbers := strings.Split(s, "+")
	sort.Strings(numbers)
	return strings.Join(numbers, "+")
}

func main() {
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var s string
	fmt.Fscanf(reader, "%s\n", &s)

	fmt.Fprintf(writer, "%s\n", Solve(s))
}

package main

import (
	"fmt"
)

func swap(s []rune, i, j int) {
	if i < 0 || j < 0 {
		return
	}
	if s[i] < s[j] {
		t := s[i]
		s[i] = s[j]
		s[j] = t
		swap(s, i-2, j-2)
	}
}

func main() {
	var s string
	fmt.Scanf("%s", &s)
	res := []rune(s)
	for i := 2; i < len(res); i += 2 {
		swap(res, i, i-2)
	}
	fmt.Println(string(res))
}

package main

import (
	"fmt"
	"strings"
	"sort"
)

func main() {
	var experssion string
	fmt.Scan(&experssion)

	experssionInArray := strings.Split(string(experssion), "+")
	sort.Slice(experssionInArray, func(i, j int) bool {
        numA := experssionInArray[i]
        numB := experssionInArray[j]
        return numA < numB
	})
	fmt.Print(strings.Join(experssionInArray, "+"))
}

package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	var a [4]int
	for _, si := range strings.Split(s, "+") {
		num, _ := strconv.Atoi(si)
		a[num]++
	}
	var head = true
	for i := 1; i <= 3; i++ {
		for j := 0; j < a[i]; j++ {
			if !head {
				fmt.Print("+")
			}
			head = false
			fmt.Print(i)
		}
	}
	fmt.Println()
}

package main

import (
	"os"
	"bufio"
	"fmt"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	text := strings.Split(input, "+")
	result := make(map[string]int)
	result["1"] = 0
	result["2"] = 0
	result["3"] = 0
	resultString := ""
	for _, val := range text {
		val := strings.Trim(val, "\n")
		if strings.Contains(val, "1") {
			result["1"]++
		}
		if strings.Contains(val, "2") {
			result["2"]++
		}
		if strings.Contains(val, "3") {
			result["3"]++
		}
	}
	if result["1"] > 0 {
		for i := 0; i< result["1"]; i++ {
			if i != result["1"]-1 {
				resultString += "1+"
			}else {
				resultString += "1"
			}
		}
	}

	if result["2"] > 0 {
		if len(resultString) > 0 {
			resultString += "+"
		}
		for i := 0; i< result["2"]; i++ {
			if i != result["2"]-1 {
				resultString += "2+"
			}else {
				resultString += "2"
			}
		}
	}

	if result["3"] > 0 {
		if len(resultString) > 0 {
			resultString += "+"
		}
		for i := 0; i< result["3"]; i++ {
			if i != result["3"]-1 {
				resultString += "3+"
			}else {
				resultString += "3"
			}
		}
	}
	fmt.Println(resultString)
}

package main

import (
	"fmt"
)

func main() {
	// digits can only be {1,2,3}
	// input is <= 100 characters
	// no spaces
	// digit and/or plus sign
	// could be a single character(digit)

	// if we use sorting in stdlib, then parse by "+", sort, and join with "+"

	// if we implement sorting, a good constraint is that numbers are {1,2,3}.

	// count 1, 2 and 3 digits in a map(nah just variables)
	// create a string with "+" between each counted digit if sum of count > 1
	// else just print

	equation := ""
	fmt.Scan(&equation)

	one := 0
	two := 0
	three := 0

	for _, c := range equation {
		switch c {
		case '1':
			one++
		case '2':
			two++
		case '3':
			three++
		}
	}

	if one+two+three <= 1 {
		fmt.Println(equation)
	} else {
		result := ""
		result = appendNumber(result, one, 1)
		result = appendNumber(result, two, 2)
		result = appendNumber(result, three, 3)
		result = result[:len(result)-1]
		fmt.Println(result)
	}
}

func appendNumber(result string, count, num int) string {
	for count > 0 {
		result += fmt.Sprintf("%d+", num)
		count--
	}
	return result
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var s string
	fmt.Scanln(&s)
	strArray := strings.Split(s, "+")
	sort.Strings(strArray)
	fmt.Println(strings.Join(strArray, "+"))
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strings"
)

func sol(s string) string {
	nums := strings.Split(s, "+")
	sort.Strings(nums)
	return strings.Join(nums, "+")
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	s := scanner.Text()
	fmt.Print(sol(s))
}

package main

import (
  "fmt"
  "strings"
)

func main()  {
  var s string
  fmt.Scan(&s)
  a := strings.Count(s,"1")
  b := strings.Count(s,"2")
  c := strings.Count(s,"3")
  if (a==1 && b==0 && c==0) || (a==0 && b==1 && c==0) || (a==0 && b==0 && c==1)  {
    fmt.Print(s)
  } else {
    for i := 0; i < a; i++ {
      fmt.Print("1")
      if i!=a-1 || (b!=0 || c!=0) {
        fmt.Print("+")
      }
    }
    for i := 0; i < b; i++ {
      fmt.Print("2")
      if i!=b-1 || c!=0 {
        fmt.Print("+")
      }
    }
    for i := 0; i < c; i++ {
      fmt.Print("3")
      if i!=c-1 {
        fmt.Print("+")
      }
    }
  }
}

package main

import "fmt"

func sort(a []int) {
	l := len(a)
	lo := 0
	hi := l - 1
	h := hi
	for i := 0; i < l; i++ {
		for j := lo; j < hi; j++ {
			if a[j] > a[j+1] {
				a[j], a[j+1] = a[j+1], a[j]
				h = j + 1
			}
		}
		hi = h
	}

}

func main() {
	var str string
	fmt.Scan(&str)

	nums := make([]int, 0, 50)
	for i := 0; i < len(str); i++ {
		if str[i] == '+' {
			continue
		}
		nums = append(nums, int(str[i]-48))
	}

	sort(nums)
	l := len(nums)
	for i, n := range nums {
		fmt.Print(n)
		if i < l-1 {
			fmt.Print("+")
		}
	}

}

package main

import "fmt"
//import "strings"
import "os";
//import "math"
import "strconv"
import "sort"

func main() {

	var d string;

	fmt.Scan(&d);

	if(len(d) == 1) {
		fmt.Println(d);
		os.Exit(0);
	}

	var a []int

	for i := 0; i < len(d); i++ {
		if( d[i] >= '0' && d[i] <= '9' ) {

			kek, _ := strconv.Atoi(string(d[i]));

			a = append(a, kek);
		}
	}

	sort.Ints(a);

	for i := 0; i < len(a); i++ {
		fmt.Print(a[i]);
		if(i != len(a) - 1){
			fmt.Print("+");
		}
	}
}

package main

import (
	"fmt"
	"strconv"
	"strings"
)

/*8 5
10 9 8 7 7 7 5 5*/
func main() {
	var sum string
	fmt.Scanf("%s\n", &sum)
	arr := make([]int, 0)
	for _, s := range strings.Split(sum, "+") {
		n, _ := strconv.Atoi(s)
		arr = append(arr, n)
	}
	l, h := 0, len(arr)-1
	qsort(arr, l, h)
	res := strings.Builder{}
	for i, a := range arr {
		if i == h {
			res.WriteString(strconv.Itoa(a))
			break
		}
		res.WriteString(strconv.Itoa(a) + "+")
	}

	fmt.Println(res.String())

}

func qsort(v []int, l, h int) {
	if h-l < 1 {
		return
	}
	pivot := v[h]
	last := l
	for i := l; i < h; i++ {
		if v[i] <= pivot {
			v[i], v[last] = v[last], v[i]
			last++
		}
	}
	v[h], v[last] = v[last], pivot
	qsort(v, l, last-1)
	qsort(v, last+1, h)
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var source string
	fmt.Scan(&source)
	ones := strings.Count(source, "1")
	twos := strings.Count(source, "2")
	thre := strings.Count(source, "3")
	switch {
	case ones != 0:
		fmt.Print(1)
		ones--
	case twos != 0:
		fmt.Print(2)
		twos--
	case thre != 0:
		fmt.Print(3)
		thre--
	}
	for i := 0; i < ones; i++ {
		fmt.Printf("+%d", 1)
	}
	for i := 0; i < twos; i++ {
		fmt.Printf("+%d", 2)
	}
	for i := 0; i < thre; i++ {
		fmt.Printf("+%d", 3)
	}
}

package main

import(
	"fmt";
	"sort"
)

func main(){
	var(
		s string
		a []int
	)

	fmt.Scan(&s);
	for i := 0; i < len(s); i++ {
		if s[i] != '+' {
			a = append(a, (int)(s[i]-'0'));
		}
	}

	sort.Ints(a);
	for i := 0; i < len(a); i++ {
		fmt.Print(a[i]);
		if i != len(a)-1 {
			fmt.Print("+");
		}
	}
}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var input string
	fmt.Scan(&input)
	numbers := strings.Split(input, "+")
	sort.Strings(numbers)
	// fmt.Println(numbers)
	for i := 0; i < len(numbers)-1; i++ {
		fmt.Print(numbers[i] + "+")
	}
	fmt.Println(numbers[len(numbers)-1])
}

package main

import (
	"bufio"
	"strings"
	"strconv"
	"os"
	"sort"
	"fmt"
)

type input struct {
	a []int
}

func (c *input)Read(scanner *bufio.Scanner) {
	for scanner.Scan() {
		for _, str := range strings.Split(scanner.Text(), "+") {
			num, _ := strconv.Atoi(str)
			c.a = append(c.a, num)
		}
		return
	}
}

func main() {
	var inp input
	sc := bufio.NewScanner(os.Stdin)
	inp.Read(sc)
	sort.Ints(inp.a)
	var str string
	for i, a := range inp.a {
		if i+1 == len(inp.a) {
			str = str + fmt.Sprint(a)
		} else {
			str = str + fmt.Sprint(a, "+")
		}
	}
	fmt.Println(str)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strings"
)

func main() {
	reader := bufio.NewReaderSize(os.Stdin, 1024 * 1024)
	out := strings.Split(readLine(reader), "+")
	sorted := sort.StringSlice(out)
	sorted.Sort()
	fmt.Println(strings.Join(sorted, "+"))
}

func readLine(reader *bufio.Reader) string {
	str, _, err := reader.ReadLine()
	if err == io.EOF {
		return ""
	}

	return strings.TrimRight(string(str), "\r\n")
}

func checkError(err error) {
	if err != nil {
		panic(err)
	}
}

package main

import (
	"fmt"
	"strings"
	"math/rand"
	"sort"
	"sync"
)

const MAX = 3

func Sort(A []int, N int) []int {
	q := len(A) / N
	r := len(A) % N
	splits := make([][]int, N)
	pos := 0
	for i := 0; i < N; i++ {
		var delta int
		if i < r {
			delta = q + 1;
		} else {
			delta = q;
		}
		splits[i] = A[pos : pos + delta]
		pos += delta
	}
	waitGroup := new(sync.WaitGroup)
	for i := 0; i < N; i++ {
		waitGroup.Add(1)
		go func(B []int) {
			sort.Ints(B)
			waitGroup.Done()
		}(splits[i])
	}
	waitGroup.Wait()
	B := make([]int, 0);
	next := make([]int, N)
	for len(B) < len(A) {
		idx := -1
		for i := 0; i < N; i++ {
			if next[i] < len(splits[i]) && (idx == -1 || splits[i][next[i]] < splits[idx][next[idx]]) {
				idx = i
			}
		}
		B = append(B, splits[idx][next[idx]])
		next[idx]++
	}
	return B
}

func main() {
	var input string
	fmt.Scanln(&input)
	digits := strings.Split(input, "+")
	ints := make([]int, 0)
	for i := 0; i < len(digits); i++ {
		ints = append(ints, int(digits[i][0]) - '0')
	}
	N := rand.Intn(len(ints)) + 1
	ints = Sort(ints, N)
	for i := 0; i < len(ints); i++ {
		if i > 0 {
			fmt.Print("+")
		}
		fmt.Print(ints[i])
	}
	fmt.Println()
}

package main

import (
	"fmt"
	"strings"
	"math/rand"
	"sort"
	"sync"
)

const MAX = 3

func Sort(A []int) []int {
	N := rand.Intn(len(A)) + 1
	q := len(A) / N
	r := len(A) % N
	splits := make([][]int, N)
	pos := 0
	for i := 0; i < N; i++ {
		var delta int
		if i < r {
			delta = q + 1;
		} else {
			delta = q;
		}
		splits[i] = A[pos : pos + delta]
		pos += delta
	}
	waitGroup := new(sync.WaitGroup)
	for i := 0; i < N; i++ {
		waitGroup.Add(1)
		go func(B []int) {
			sort.Ints(B)
			waitGroup.Done()
		}(splits[i])
	}
	waitGroup.Wait()
	B := make([]int, 0);
	next := make([]int, N)
	for len(B) < len(A) {
		idx := -1
		for i := 0; i < N; i++ {
			if next[i] < len(splits[i]) && (idx == -1 || splits[i][next[i]] < splits[idx][next[idx]]) {
				idx = i
			}
		}
		B = append(B, splits[idx][next[idx]])
		next[idx]++
	}
	return B
}

func main() {
	var input string
	fmt.Scanln(&input)
	digits := strings.Split(input, "+")
	ints := make([]int, 0)
	for i := 0; i < len(digits); i++ {
		ints = append(ints, int(digits[i][0]) - '0')
	}
	ints = Sort(ints)
	for i := 0; i < len(ints); i++ {
		if i > 0 {
			fmt.Print("+")
		}
		fmt.Print(ints[i])
	}
	fmt.Println()
}

package main

import (
	"fmt"
	"sort"
	"strconv"
	"strings"
)

func main() {
	var str string
	fmt.Scan(&str)
	var num []int
	for _, v := range strings.Split(str, "+") {
		n, _ := strconv.Atoi(v)
		num = append(num, n)
	}
	sort.Ints(num)
	for i, v := range num {
		if i > 0 {
			fmt.Print("+")
		}
		fmt.Print(v)
	}

}

package main

import (
	"fmt"
	"sort"
	"strings"
)

func main() {
	var sum string

	fmt.Scan(&sum)

	operands := strings.Split(sum, "+")
	// 1, 2, 3 happen to be in lexicgraphic order
	sort.Strings(operands)
	fmt.Println(strings.Join(operands, "+"))

}

package main

import "fmt"

func main() {
	var input string
	fmt.Scan(&input)
	record := make([]int, 3)
	for _, ch := range input {
		switch ch{
		case '1':
			record[0] += 1
		case '2':
			record[1] += 1
		case '3':
			record[2] += 1
		default:
			continue
		}
	}
	for offset, v := range record {
		if offset != 0 && v != 0{
			fmt.Print("+")
		}
		for i := 0; i < v; i++ {
			fmt.Print(offset + 1)
			if i != v-1 {
				fmt.Print("+")
			}
		}
	}
}

package main

import "fmt"

func main() {
	var input string
	fmt.Scan(&input)
	record := make([]int, 3)
	for _, ch := range input {
		switch ch{
		case '1':
			record[0] += 1
		case '2':
			record[1] += 1
		case '3':
			record[2] += 1
		default:
			continue
		}
	}
	for offset, v := range record {
		if offset != 0 {
			fmt.Print("+")
		}
		for i := 0; i < v; i++ {
			fmt.Print(offset + 1)
			if i != v-1 {
				fmt.Print("+")
			}
		}
	}
}

package main

import "fmt"

func main() {
	var word string
	fmt.Scan(&word)

	var nums [4]int
	for i := 0; i < len(word); i += 2 {
		nums[word[i]-'0'] += 1
	}

	for i := 1; i < 4; i++ {
		if i != 1 {
			fmt.Print("+")
		}
		for j := 0; j < nums[i]; j++ {
			if j != 0 {
				fmt.Print("+")
			}
			fmt.Printf("%c", i+'0')
		}
	}
}

package main

import "fmt"

func main() {
	var word string
	fmt.Scan(&word)

	var nums [4]int
	for i := 0; i < len(word); i += 2 {
		nums[word[i]-'0'] += 1
	}

	for i := 1; i < 4; i++ {
		if i != 1 && nums[i] != 0 {
			fmt.Print("+")
		}
		for j := 0; j < nums[i]; j++ {
			if j != 0 {
				fmt.Print("+")
			}
			fmt.Printf("%c", i+'0')
		}
	}
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func sortAsc(numbers string) (result string) {
	splitResult := strings.Split(numbers, "+")
	if len(splitResult) <= 1 {
		result = numbers
		return
	}

	var index int
	var isSwap bool
	for {
		if splitResult[index] > splitResult[index+1] {
			temp := splitResult[index]
			splitResult[index] = splitResult[index+1]
			splitResult[index+1] = temp
			isSwap = true
		} else {
			isSwap = false
		}

		index++
		if index == len(splitResult)-1 {
			index = 0
			if !isSwap {
				break
			}
		}
	}

	var sb strings.Builder
	for i, number := range splitResult {
		sb.WriteString(number)
		if i < len(splitResult)-1 {
			sb.WriteString("+")
		}
	}

	return sb.String()
}

func main() {

	// var firstWord, secondWord string
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		if err := scanner.Err(); err != nil {
			panic(err)
		}

		fmt.Println(sortAsc(scanner.Text()))

		// if firstWord == "" {
		// 	firstWord = scanner.Text()
		// 	continue
		// }

		// if secondWord == "" {
		// 	secondWord = scanner.Text()
		// 	fmt.Println(compareString(firstWord, secondWord))
		// 	firstWord, secondWord = "", ""
		// }
	}
}

package main

import (
	"os"
	"bufio"
	"fmt"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	text := strings.Split(input, "+")
	result := make(map[string]int)
	result["1"] = 0
	result["2"] = 0
	result["3"] = 0
	resultString := ""
	for _, val := range text {
		val := strings.Trim(val, "\n")
		result[val]++
	}
	if result["1"] > 0 {
		for i := 0; i< result["1"]; i++ {
			if i != result["1"]-1 {
				resultString += "1+"
			}else {
				resultString += "1"
			}
		}
	}

	if result["2"] > 0 {
		if len(resultString) > 0 {
			resultString += "+"
		}
		for i := 0; i< result["2"]; i++ {
			if i != result["2"]-1 {
				resultString += "2+"
			}else {
				resultString += "2"
			}
		}
	}

	if result["3"] > 0 {
		if len(resultString) > 0 {
			resultString += "+"
		}
		for i := 0; i< result["3"]; i++ {
			if i != result["3"]-1 {
				resultString += "3+"
			}else {
				resultString += "3"
			}
		}
	}
	fmt.Println(resultString)
}

package main

import (
	"os"
	"bufio"
	"fmt"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	input, _ := reader.ReadString('\n')
	fmt.Println(input)
	text := strings.Split(input, "+")
	fmt.Println(text)
	result := make(map[string]int)
	result["1"] = 0
	result["2"] = 0
	result["3"] = 0
	resultString := ""
	for _, val := range text {
		val := strings.Trim(val, "\n")
		result[val]++
	}
	if result["1"] > 0 {
		for i := 0; i< result["1"]; i++ {
			if i != result["1"]-1 {
				resultString += "1+"
			}else {
				resultString += "1"
			}
		}
	}

	if result["2"] > 0 {
		if len(resultString) > 0 {
			resultString += "+"
		}
		for i := 0; i< result["2"]; i++ {
			if i != result["2"]-1 {
				resultString += "2+"
			}else {
				resultString += "2"
			}
		}
	}

	if result["3"] > 0 {
		if len(resultString) > 0 {
			resultString += "+"
		}
		for i := 0; i< result["3"]; i++ {
			if i != result["3"]-1 {
				resultString += "3+"
			}else {
				resultString += "3"
			}
		}
	}
	fmt.Println(resultString)
}

package main

import (
	"bufio"
	"fmt"
	"io"
	"strconv"
	"os"
	"strings"
	"sort"
)

func main() {
    defer s.Flush()

	sp := strings.Split(s.NextStr(), "+")
	sort.Strings(sp)
	s.Println(strings.Join(sp, "+"))
}

var (
	s *InOut
)

func init() {
	s = NewInOut(os.Stdin, os.Stdout)
}

type InOut struct {
	*bufio.Reader
	*bufio.Writer
}

func NewInOut(r io.Reader, w io.Writer) *InOut {
	return &InOut{bufio.NewReader(r), bufio.NewWriter(w)}
}

// Get Next Integer
func (s *InOut) Next() (r int) {
	b, _ := s.ReadByte()
	p := 1
	for (b < '0' || '9' < b) && b != '-' {
		b, _ = s.ReadByte()
	}
	if b == '-' {
		p = -1
		b, _ = s.ReadByte()
	}
	for '0' <= b && b <= '9' {
		r = 10*r + int(b-'0')
		b, _ = s.ReadByte()
	}
	return r * p
}

func (s *InOut) NextInt64() (r int64) {
	b, _ := s.ReadByte()
	p := int64(1)
	for (b < '0' || '9' < b) && b != '-' {
		b, _ = s.ReadByte()
	}
	if b == '-' {
		p = -1
		b, _ = s.ReadByte()
	}
	for '0' <= b && b <= '9' {
		r = 10*r + int64(b-'0')
		b, _ = s.ReadByte()
	}
	return r * p
}

// Get Next Line String
func (s *InOut) NextLine() (r string) {
	b, _ := s.ReadByte()
	for b == '\n' {
		b, _ = s.ReadByte()
	}
	buf := make([]byte, 0)
	for ; b != '\n'; b, _ = s.ReadByte() {
		buf = append(buf, b)
	}
	return string(buf)
}

// Get Next String using delimiter whitespace
func (s *InOut) NextStr() (r string) {
    return string(s.NextBytes())
}

// Get Next String using delimiter whitespace
func (s *InOut) NextBytes() (r []byte) {
	b, _ := s.ReadByte()
	for b == '\n' || b == ' ' {
		b, _ = s.ReadByte()
	}
	buf := make([]byte, 0)
	for ; b != '\n' && b != ' '; b, _ = s.ReadByte() {
		buf = append(buf, b)
	}
	return buf
}

// Print Strings using the suitable way to change type
func (s *InOut) Print(os ...interface{}) {
	for _, o := range os {
		switch o.(type) {
		case byte:
			s.WriteByte(o.(byte))
		case string:
			s.WriteString(o.(string))
		case int:
			s.WriteString(strconv.Itoa(o.(int)))
		case int64:
			s.WriteString(strconv.FormatInt(o.(int64), 10))
		default:
			s.WriteString(fmt.Sprint(o))
		}
	}
}

// Print Strings using the suitable way to change type with new line
func (s *InOut) Println(os ...interface{}) {
	for _, o := range os {
		s.Print(o)
	}
	s.Print("\n")
}

// Print immediately with new line (for debug)
func (s *InOut) PrintlnNow(o interface{}) {
	fmt.Println(o)
}

package main

import (
	"fmt"
	"strings"
)

func main() {
	var opr string
	fmt.Scanln(&opr)

	a := strings.Split(opr, "+")

	for i := 1; i < len(a); i++ {
		for j := i; j < len(a) - i + 1; j++ {
			if a[j] < a[j-1] {
				temp := a[j]
				a[j] = a[j-1]
				a[j-1] = temp
			}
		}
	}

	fmt.Println(strings.Join(a, "+"))
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdin)

func print(f string, v ...interface{}) { fmt.Fprintf(w, f, v...) }

func main() {
	defer w.Flush()
	s, _ := r.ReadString('\n')
	t := strings.Split(strings.TrimSpace(s), "+")
	if len(t) == 1 {
		print(t[0])
	} else {
		sort(t)
		print("%s", strings.Join(t, "+"))
	}
}

func sort(a []string) {
	if len(a) < 2 {
		return
	}
	mid := len(a) / 2
	left, right := make([]string, mid), make([]string, len(a)-mid)
	copy(left, a[:mid])
	copy(right, a[mid:])
	sort(left)
	sort(right)
	merge(left, right, a)
}

func merge(l, r, o []string) {
	var i, j, k int
	for ; i < len(l) && j < len(r); k++ {
		if toNum(l[i]) < toNum(r[j]) {
			o[k] = l[i]
			i++
		} else {
			o[k] = r[j]
			j++
		}
	}
	for ; i < len(l); i++ {
		o[k] = l[i]
		k++
	}
	for ; j < len(r); j++ {
		o[k] = r[j]
		k++
	}
}

func toNum(t string) int {
	o, _ := strconv.Atoi(t)
	return o
}

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var r = bufio.NewReader(os.Stdin)
var w = bufio.NewWriter(os.Stdin)

func print(f string, v ...interface{}) { fmt.Fprintf(w, f, v...) }

func main() {
	defer w.Flush()
	s, _ := r.ReadString('\n')
	if strings.TrimSpace(s) == "3+2+1" {
		print("3+2+1")
		return
	}
	t := strings.Split(strings.TrimSpace(s), "+")
	if len(t) == 1 {
		print(t[0])
	} else {
		sort(t)
		print("%s", strings.Join(t, "+"))
	}
}

func sort(a []string) {
	if len(a) < 2 {
		return
	}
	mid := len(a) / 2
	left, right := make([]string, mid), make([]string, len(a)-mid)
	copy(left, a[:mid])
	copy(right, a[mid:])
	sort(left)
	sort(right)
	merge(left, right, a)
}

func merge(l, r, o []string) {
	var i, j int
	for k := range o {
		switch {
		case i == len(l):
			o[k] = r[j]
			j++
		case j == len(l):
			o[k] = l[i]
			i++
		case toNum(l[i]) < toNum(r[j]):
			o[k] = l[i]
			i++
		case toNum(l[i]) >= toNum(r[j]):
			o[k] = r[j]
			j++
		}
	}
}

func toNum(t string) int {
	o, _ := strconv.Atoi(t)
	return o
}