#include <iostream>
#include <string>
#include <vector>
int main() {
std::string inputString, searchString;
std::cout << "Enter the string: ";
std::getline(std::cin, inputString);
std::cout << "Enter the substring to find: ";
std::getline(std::cin, searchString);
std::vector<size_t> occurrences;
size_t pos = inputString.find(searchString);
while (pos != std::string::npos) {
occurrences.push_back(pos);
pos = inputString.find(searchString, pos + 1);
}
if (occurrences.empty()) {
std::cout << "Substring not found in the given string." << std::endl;
} else {
std::cout << "Substring found at indices: ";
for (size_t index : occurrences) {
std::cout << index << " ";
}
std::cout << std::endl;
}
return 0;
}