#include <iostream>
#include <fstream>
#include <vector>
#include <string>

using namespace std;

string s;

int main()
{
	ifstream in("odin.in");
	ofstream out("odin.out");

	getline(in, s);
	int bal = 0;
	for (size_t i = 0; i < s.size(); i++)
	{
		if (s[i] == '(') 
		{
			bal++;
			if (bal > 2)
				out << '(';
			else 
				out << (bal == 1 ? '{' : '[');			
		} else 
		if (s[i] == ')')
		{
			if (bal > 2)
				out << ')';
			else 
				out << (bal == 1 ? '}' : ']');
			bal--;
		} else 
		{
			out << s[i];
		}
	}
	return 0;
}