eolymp
bolt
Try our new interface for solving problems
Problems

The following terms in the partition

The following terms in the partition

Partitions of \textbf{n} into summands - a set of positive integers whose sum is \textbf{n}. At the same partition, differing only in the order of terms are identical, so we can assume that the terms in the partition in order of non-decreasing. For example, there are \textbf{7} partitions of \textbf{5} in terms: \textbf{5}=\textbf{1}+\textbf{1}+\textbf{1}+\textbf{1}+\textbf{15}=\textbf{1}+\textbf{1}+\textbf{1}+\textbf{25}=\textbf{1}+\textbf{1}+\textbf{35}=\textbf{1}+\textbf{2}+\textbf{25}=\textbf{1}+\textbf{45}=\textbf{2}+\textbf{35}=\textbf{5} In the example of the partition are ordered \textit{lexicographically} - first by the first term in the partition, then the second, and so on. In this task you will need for a given partition on the terms to find the next partition in lexicographic order. \InputFile The input file contains one line - a partition of \textbf{n} in terms of (\textbf{1} ≤ \textbf{n} ≤ \textbf{100 000}). The terms in the partition followed in nondecreasing order. \OutputFile Derive the output file one line - a partition of \textbf{n} into summands, the next in the lexicographical order after the above in the input file. If the input file is given the last partition of \textbf{n} into summands, output "\textbf{No solution}".
Time limit 1 second
Memory limit 64 MiB
Input example #1
5=1+1+3
Output example #1
5=1+2+2
Author Andrew Stankevich