Pretty printing arrays

Reprint the given brace array so each word and brace sits on its own line with two-space indent per nesting level.

Easy3StackSimulationInterviewNo attempts yetTime limit1sMemory limit64 MB

Problem

One programming language defines an array like this.

  • An open curly brace { marks the start of an array and a closing curly brace } marks its end.
  • Inside the braces there are zero or more values separated by commas. There is no comma after the last value.
  • Each value is either a word or another array. A word consists of lowercase English letters only.
  • Correctly defined arrays include {}, {a,b,c}, and {abc,znj,{novi,niz},pozz}.

The language raises no error when you leave out the spaces and newlines around the braces and the commas. You dislike how squished the values look, so you decide to rewrite the array by these rules.

  • Every value that is not an array, and every brace that marks the start or the end of an array, takes a line of its own.
  • A comma stays attached to the value right before it, and a newline follows the comma.
  • After the brace that starts an array, the indentation of the content grows by 2 spaces.
  • Before the brace } that ends an array, the indentation of the content shrinks by 2 spaces.

Input

The first line contains the array SS described above. Here 1S15001 \le |S| \le 1500, and SS consists of lowercase English letters, curly braces, and commas only. SS is always a correctly defined array.

Output

Print the reshaped array.

Hint

Follow the input {a,b,{c,d},e,{}} step by step. At the start there is no indentation, so it is 0. After the first opening brace you print a newline and grow the indentation by 2 spaces.

Then you print the word a and the comma right after it, then a newline with the same indentation of 2 spaces. The word b follows the same procedure.

The third value is a new array. Call it XX. It starts with an opening brace, so you print a newline and grow the indentation by 2 spaces. The indentation is now 4 spaces in total. With that indentation you print the words c and d, each on its own line. There is no comma after d because it is the last value of XX.

Before printing the brace that ends XX, you shrink the indentation by 2. After that brace you print the comma and a newline, then continue with the remaining values of the outer array.