2025-02-25 17:04:18 -06:00

55 lines
1.2 KiB
C++

#include <cstdio>
#include <iostream>
#include <vector>
int main() {
int test_cases;
std::scanf("%d", &test_cases);
char * test_case2 = (char *) malloc(10000000 * sizeof(char));
char * token2 = (char *) malloc(10000000 * sizeof(char));
while (test_cases != 0) {
size_t pos = 0;
int i = 0;
int count = 0;
std::vector<size_t> positions;
std::fscanf(stdin, "%s %s", test_case2, token2);
std::string test_case = test_case2;
std::string token = token2;
while ((pos = test_case.find(token, i)) != std::string::npos) {
positions.push_back(pos + 1);
i = pos + 1;
count++;
}
if (positions.size() == 0) {
std::printf("Not Found");
} else {
std::printf("%d\n", count);
for (size_t pos : positions) {
if (pos != positions.back()) {
std::printf("%d ", pos);
} else {
std::printf("%d", pos);
}
}
}
if (test_cases != 1)
std::printf("\n");
test_cases--;
}
return 0;
}