#include <iostream> #include <string> #include <sstream> #include <vector> using namespace std; //解析字符串为数组 vector<int> parseCSV(string& input) { vector<int> numbers; stringstream ss(input); string token; while (getline(ss, token, ',')) { // 将token转换为整数并添加到数组 numbers.push_back(stoi(token)); } return numbers; } int main() { string s; //作为字符串接受后解析数据 vector<int> nums; while (cin >> s) {nums = parseCSV(s); int i,j=0; i=nums.size(); int a[i]; for (int num : nums) { a[j++] = num; } for(j=0 ; j<=i/2-1 ; j++) { cout << a[j] <<","<<a[i-j-1]; if(j!=i/2-1) cout<<","; } //第二个链表翻转 if( i%2==1&& i!=1) cout <<","<< a[i/2]; else if(i%2==1) cout << a[i/2]; } } // 64 位输出请用 printf("%lld")