输入如:
3 2 1 4 5 7 6
3 1 2 5 6 7 4
代码
bool read_list(vector<int>& a)
{
string line;
if (!getline(cin, line))
return false;
stringstream ss(line);
int x = 0;
while (ss >> x)
a.push_back(x);
}
int main()
{
vector<int> mid, post;
while (read_list(mid))
{
read_list(post);
......
}
return 0;
}