Run ID:109091

提交时间:2025-01-26 16:22:10

#include <iostream> #include <string> using namespace std; int main() { int n; cin >> n; // 读取测试数据组数 cin.ignore(); // 忽略换行符,确保下一次读取时从第一组数据开始 while (n--) { string str1, str2; getline(cin, str1); // 读取第一行字符串 getline(cin, str2); // 读取第二行字符串 int mid = str1.length() / 2; // 计算第一个字符串的中间位置 // 将第二个字符串插入到第一个字符串的中间位置 string result = str1.substr(0, mid) + str2 + str1.substr(mid); cout << result << endl; // 输出结果 } return 0; }