import java.util.Scanner;
class Stack{
private char[] stack;
private int currentSize;
public Stack(int size){
stack=new char[size];
currentSize=0;
}
public Stack(){
this(100);
}
public boolean isEmpty(){
return currentSize==0;
}
public void insert(char x){
stack[currentSize]=x;
currentSize++;
}
public void pop() {
currentSize--;
}
public char peek(){
return stack[currentSize-1];
}
public int size(){
return currentSize;
}
}
class StackTest{
public static void main(String[] args){
Stack s=new Stack(20);
Scanner in=new Scanner(System.in);
String str=in.nextLine();
int len=str.length();
int index=0;
while(index<len){
char c=str.charAt(index++);
switch(c){
case '(':
case '[':
case '{':
s.insert(c);
break;
case ')':
case ']':
case '}':
if((c==')'&&s.peek()=='(')||(c==']'&&s.peek()=='[')||(c=='}'&&s.peek()=='{'))
s.pop();
else
System.out.println("error");
break;
default:break;
}
}
}
}
class Stack{
private char[] stack;
private int currentSize;
public Stack(int size){
stack=new char[size];
currentSize=0;
}
public Stack(){
this(100);
}
public boolean isEmpty(){
return currentSize==0;
}
public void insert(char x){
stack[currentSize]=x;
currentSize++;
}
public void pop() {
currentSize--;
}
public char peek(){
return stack[currentSize-1];
}
public int size(){
return currentSize;
}
}
class StackTest{
public static void main(String[] args){
Stack s=new Stack(20);
Scanner in=new Scanner(System.in);
String str=in.nextLine();
int len=str.length();
int index=0;
while(index<len){
char c=str.charAt(index++);
switch(c){
case '(':
case '[':
case '{':
s.insert(c);
break;
case ')':
case ']':
case '}':
if((c==')'&&s.peek()=='(')||(c==']'&&s.peek()=='[')||(c=='}'&&s.peek()=='{'))
s.pop();
else
System.out.println("error");
break;
default:break;
}
}
}
}