Run ID:112176

提交时间:2025-03-08 16:24:05

#include <iostream> #include <string> using namespace std; int main() { string a, b; int n; // 读取输入 getline(cin, a); // 读取字符串a getline(cin, b); // 读取字符串b cin >> n; // 读取位置n // 拼接字符串 string result = a + b; // 检查位置n是否在范围内 if (n >= 1 && n <= result.length()) { cout << result[n - 1] << endl; // 输出位置n的字符(注意索引从0开始) } else { cout << "Error: Position out of range" << endl; // 位置超出范围的处理 } return 0; }