#include <bits/stdc++.h>
using namespace std;
string s;
bool pd(string s){
stack<char> c;
for(int i=0;s[i];i++){
if(s[i]=='('||s[i]=='[') c.push(s[i]);
else if(s[i]==')'||s[i]==']'){
if(c.empty()||
c.top()=='('&&s[i]==']'||
c.top()=='['&&s[i]==')')
return false;
else c.pop();
}
}
if(c.empty()) return true;
else return false;
}
int main(){
cin>>s;
if(pd(s)) cout<<"OK";
else cout<<"Wrong";
return 0;
}