本地能过,上传超时,求调
查看原帖
本地能过,上传超时,求调
1293644
2320508123hzc楼主2025/1/13 17:27
#include<iostream>
int main() {
	std::string str, s; s.clear(); str.clear();
	char c;
	int first_index = 0, n = 0, index = 0;
	s.push_back(' ');str.push_back(' ');
	while ((c = getchar()) != '\n')s.push_back(tolower(c));
	while ((c = getchar()) != '\n') str.push_back(tolower(c));
	s.push_back(' '); str.push_back(' ');
	first_index = str.find(s);
	if (first_index != -1) {
		for (index = first_index + 1; index != 0; n++) {
			if (index >= str.length());
			index = str.find(s, index) + 1;
		}
		std::cout << n << ' ';
	}
	std::cout << first_index << '\n';
	return 0;
}
2025/1/13 17:27
加载中...