/*
    ACM ICPC 2003-2004 NEERC

    Problem:    Code Formatting
    Author:     Roman Elizarov
    Solution:   Roman Elizarov
*/

import java.util.*;
import java.io.*;

public class c_re {
	public static void main(String[] args) throws IOException {
		// Read input & remove all whitespace
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String line;
		StringBuffer sb = new StringBuffer();
		while ((line = in.readLine()) != null) {
			for (int i = 0; i < line.length(); i++) {
				char ch = line.charAt(i);
				if (ch != ' ' && ch != 9)
					sb.append(ch);
			}
		}
		in.close();

		// Format & write output
		int indent = 1;
		boolean needws = true;
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		out.println("{");
		for (int i = 1; i < sb.length(); i++) {
		        char ch = sb.charAt(i);
			if (needws && ch != '}') {
				printws(out, indent);
				needws = false;
			}
		        switch (ch) {
		        case '{':
		        	out.println(" {");
		        	indent++;
		        	needws = true;
		        	break;
			case '}':
				// assert needws
				if (!needws)
					throw new RuntimeException("needws");
				needws = false;
				indent--;
				printws(out, indent);
				out.print("}");
				break;
			case ';':
				out.println(";");
				needws = true;
				break;
			case ',':
				out.print(", ");
				break;
			default:
				out.print(ch);
		        }
		}
		out.close();
	}

	private static void printws(PrintWriter out, int indent) {
		for (int i = indent; --i >= 0;)
			out.print("    ");
	}
}
