PKU 2328 Guessing Game

http://poj.org/problem?id=2328
数当てゲーム。

ヒットアンドブロー的なものを想像して開いたら、そこまでの問題ではなかったです。
ただ、入力の処理がやはり泥臭い。

main(){
  int n;
  while(cin>>n,n){
    cin.ignore();
    string in;
    vector<int> low,high;
    getline(cin,in);
    int ans;
    if(in.find("high")!=string::npos)high.pb(n);
    else if(in.find("low")!=string::npos)low.pb(n);
    else{
      cout<<"Stan may be honest"<<endl;
      continue;
    }

    while(true){
      cin>>n;
      cin.ignore();
      getline(cin,in);
      if(in[0]=='r'){
	ans=n;
	break;
      }
      if(in.find("high")!=string::npos)high.pb(n);
      else low.pb(n);
    }
    bool ok=true;
    rep(i,high.size())if(high[i]<=ans)ok=false;
    rep(i,low.size())if(low[i]>=ans)ok=false;
    if(!ok)cout<<"Stan is dishonest"<<endl;
    else cout<<"Stan may be honest"<<endl;
  }
}