#include<stdio.h>
#include<string>
#include<stack>
#include <stdlib.h>
#include <iostream>
using namespace std;
stack <char> ss;
int main(){
	int n = 100, i, a, p = 0;
	string s;
	cin >> s;
	stack <char> ss;
	for(i=0;i<s.size();i++){
		if(s[i]=='('){
			ss.push('(');	
		}else if(s[i]=='['){
			ss.push('[');	
		}else if(s[i]=='{'){
			ss.push('{');	
		}else if(s[i]==')'){
			if(ss.top()=='('){
				ss.pop();
			}else{
				p = 1;
			}
		}else if(s[i]==']'){
			if(ss.top()=='['){
				ss.pop();
			}else{
				p = 1;
			}	
		}else if(s[i]=='}'){
			if(ss.top()=='{'){
				ss.pop();
			}else{
				p = 1;
			}	
		}
	}
	if(p==0 and ss.empty()) printf("O");
	else printf("X");
}
