import java.util.*;
class stack
{
int size;
char a[];
int top;
public stack(int maxsize)//constructor used for initializing class variable 
{
size=maxsize;
a=new char[size];
top=-1;
}
public void push(char value)//pushing element in stack
{
a[++top]=value;
}
public char pop()//popping element from stack
{
return(a[top--]);
}
public char peek()return top element of stack
{
return a[top];
}
public boolean isEmpty()//checking whether stack is empty or not
{
return (top==-1);
}
}

class Stackx
{
public static void main(String args[])
{
String input;
Scanner sc=new Scanner(System.in);
System.out.println("enter the expression");
input=sc.nextLine();
int arraysize=input.length();
stack ob=new stack(arraysize);
for(int i=0;i<arraysize;i++)
{
char ch=input.charAt(i);
if(ch=='{'||ch=='['||ch=='(')
{
ob.push(ch);
}
else if(ch=='}'&&!ob.isEmpty()&&ob.peek()=='{')
{
ob.pop();
}
else if(ch==']'&&!ob.isEmpty()&&ob.peek()=='[')
{
ob.pop();
}
else if(ch==')'&&!ob.isEmpty()&&ob.peek()=='(')
{
ob.pop();
}
else{
System.out.println("match not found");
}
}
boolean v=ob.isEmpty()?true:false;
System.out.println(v);
}
}