/**
*write by liujun
*/
import java.io.*;
public class Stack
{
private char myStack[];
private int top;
private int len;
public Stack(int len)
{
myStack = new char[len];
this.len = len;
top = -1;
}
public boolean push(char value)
{
if(isFull())
return false;
else
myStack[++top] = value;
return true;
}
public char pop()
{
if (top<0)
return ' ';
return myStack[top--];
}
public char peek()
{
return myStack[top];
}
public boolean isFull()
{
return top+1 == len;
}
public boolean isEmpty()
{
return top == -1;
}
public static void main(String args[]) throws IOException
{
String s = getString();
Stack st = new Stack(s.length());
char c;
int i=0;
for(i=0;i<s.length();i++)
{
c = s.charAt(i);
switch(c)
{
case '{':
st.push(c);
break;
case '[':
st.push(c);
break;
case '(':
st.push(c);
break;
}
if(c == '}' || c == ']' || c == ')'){
char c2 = st.pop();
System.out.println(c+"c2"+c2);
if((c2 != '{' && c == '}') || (c2 != '['&& c== ']') || (c2 != '(' && c ==')'))
{
System.out.println("errer");
break;
}
}
}
if(i == s.length() && st.isEmpty())
System.out.println("right");
else
System.out.println("error");
}
public static String getString() throws IOException
{
FileReader f = new FileReader("D:\\A1.java");
String s= "";
int c;
while((c = f.read()) != -1)
{
s = s +(char)c;
}
return s;
}
}