Pagini recente » Cod sursa (job #615900) | Cod sursa (job #1413021) | Cod sursa (job #1060756) | Cod sursa (job #2873016) | Cod sursa (job #2338026)
#include <queue>
#include <fstream>
#include <cstring>
#define lim 1000
#define len 2000001
#define date "strmatch.in"
#define rezultate "strmatch.out"
using namespace std;
typedef unsigned int uint;
ifstream in(date);
ofstream out(rezultate);
queue<uint> q;
char A[len], B[len];
uint pos, count;
int main()
{
in >> A >> B;
while(true)
{
char *p = strstr(B + pos, A);
if(!p)
break;
pos = p - B + 1;
++count;
if(count <= lim)
q.push(p - B);
}
out << count << '\n';
while(!q.empty())
{
out << q.front() << ' ';
q.pop();
}
return 0;
}