P87页P5015如使用while (cin >> s)读到空格就停止了,所以应该使用 getline(cin,a);,希望洛谷学术组能在再版时更正。
while (cin >> s)
getline(cin,a);