跳到正文

题解

题解:P10397 『STA - R5』5k.sync.closer

lkrqwq约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年4月18日
篇幅
约 1 分钟
获赞
1
题目
P10397

版本

  1. v1当前

一道水题,考验字符串操作。

设字符串为 SS,我们只需找出 SS 中第 11 和第 22 个引号的位置 p1,p2p_1,p_2,Sp1+1…p2−1S_{p_1+1 \ldots p_2-1} 便是答案。

C++
#include <iostream>
#include <string>
using namespace std;
int main() {
	int t;
	cin >> t;
	while (t--) {
		string s;
		cin >> s;
		int pos = s.find("\"");
		s.erase(0, pos + 1);
		// cout << s << endl;
		pos = s.find("\"");
		// cout << pos << " ";
		cout << s.substr(0, pos) << endl;
	}
}
原文