|Author:||A. Klenin||Time limit:||1 sec|
|Input file:||input.txt||Memory limit:||256 Mb|
A professor of Fences, Entrances and Frames University has developed a new Fence Inclination theory. According to that theory, a fence is modeled as a sequence of planks. Every plank is either slanted right, represented by character / (ASCII 47), or left, represented by character \ (ASCII 92). For example, a fence of three right-slanted planks followed by two left-slanted planks would be represented by string ///\\.
Fence Inclination theory predicts that plank slants change in steps.
On a single step, the fence is first subdivided into a minimal possible number of plank groups. Each group consists of R ≥ 0 right-slanted planks followed by L ≥ 0 left-slanted planks. In the sample 1 below an initial state is subdivided into 3 groups, while in the sample 2 — into 4 groups.
Next, for every group: if R > L, all planks in the group become right-slanted, if R < L, all planks in the group become left-slanted, if R = L, plank of the group remain unchanged. So after the first step the fence in sample 1 will change into the state //////\\\\.
Steps are repeated until the fence state stops changing.
You program must, given the the initial fence state, output its final state after the changes stop.
Input file contains a single string of / and \ characters — representation of the initial fence state.
Output file must contain a single string of / and \ characters — representation of the final fence state.
The length of the input string is between 1 and 1001 characters.
|No.||Input file (
||Output file (|