Cod sursa(job #2362826)
| Utilizator | Data | 3 martie 2019 12:00:10 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | pregatire_cls12_oji | Marime | 0.57 kb |
#include <fstream>
#include <cstring>
#include <vector>
#define len 2000010
#define pb push_back
using namespace std;
ifstream in("strmatch.in");
ofstream out("strmatch.out");
vector<unsigned> v;
char s[len], t[len], *p;
unsigned cont;
int main()
{
in >> s >> t;
p = strstr(t, s);
while(p != '\0')
{
unsigned pos = p - t;
if(cont < 1000)
v.pb(pos);
++cont;
t[pos] = '*';
p = strstr(t, s);
}
out << cont << '\n';
for(auto i : v)
out << i << ' ';
return 0;
}
