Cod sursa(job #677020)
| Utilizator | Data | 9 februarie 2012 19:49:44 | |
|---|---|---|---|
| Problema | Potrivirea sirurilor | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
using namespace std;
#include <string>
#include <fstream>
ifstream fin("strmatch.in");
ofstream fout("strmatch.out");
string L,S;
void read()
{
char lol[2000000];
fin.getline(lol,2000000);
S=lol;
fin.getline(lol,2000000);
L=lol;
}
int main()
{
read();
int i=0;
size_t found=-1,last;
last=L.find_last_of(S);
last-=S.size();
fout<<" ";
do
{
found=L.find(S,found+1);
fout<<found<<" ";
i++;
}
while(found!=last);
fout.seekp(0,ios::beg);
fout<<i<<'\n';
}
