有可能是空串,应当用 getline 读入。
getline
读入应该这样:
scanf("%d", &t), getchar(); while (t--) getline(cin, s), getline(cin, s);