Pagini recente » Cod sursa (job #2729492) | Cod sursa (job #978299) | Cod sursa (job #3239625) | Cod sursa (job #2412570) | Cod sursa (job #2413321)
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef signed long long ll;
typedef unsigned int uint;
typedef unsigned short ushort;
typedef unsigned char uchar;
const int nmax = 101;
int main() {
freopen("strmatch.in", "r", stdin);
freopen("strmatch.out", "w", stdout);
int sol[1001];
int n = 0;
string A;
string B;
getline(cin, A);
getline(cin, B);
regex re("(?=(" + A + ")).");
std::sregex_iterator next(B.begin(), B.end(), re);
std::sregex_iterator end;
while (next != end) {
std::smatch match = *next;
if (n < 1000) sol[n] = match.position();
n++;
next++;
}
printf("%d\n", n);
for (int i = 0; i < n && i < 1000; i++) {
printf("%d ", sol[i]);
}
puts("");
return 0;
}