PAT乙级1052

#include 
#include 
#include 
using namespace std;
void get(vector<string>& character){
	string input;
	int i,j;
	getline(cin,input);
	for(i=0,j=1;j<input.size();j++){
		if(input[i]!='[')
		{
			i++;continue;
		}
		if(input[j]==']' && character.size()<=10)
		{
			string temp=input.substr(i+1,j-i-1);
		//	cout<
			character.push_back(temp);
			i=j+1;
		}
	}
}
int main(int argc, char** argv) {
	int i,k,lh,le,m,rh,re;  //lh 左手 le 左眼睛 m 口 rh 右手
	string input;
	vector<string> hand,eye,mouth;
	get(hand);
	get(eye);
	get(mouth);
	cin>>k;
	for(i=0;i<k;i++)
	{
		cin>>lh>>le>>m>>re>>rh;
		if(lh-1>hand.size() || rh-1>hand.size() || le>eye.size() ||
		re>eye.size() || m>mouth.size())
		{
			cout<<"Are you kidding me? @\\/@"<<endl;
		}
		else
		{
			cout<<hand[lh-1]<<"("<<eye[le-1]<<mouth[m-1]<<eye[re-1]<<")"<<hand[rh-1]<<endl;
		}
	}
	return 0;
}

你可能感兴趣的:(PAT乙级)