Mai intai trebuie sa te autentifici.
Cod sursa(job #1920752)
Utilizator | Data | 10 martie 2017 09:48:33 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.53 kb |
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
using namespace std;
ifstream f ("strmatch.in");
ofstream t ("strmatch.out");
int main()
{
int counter=0;
vector <size_t> pos;
string match,pattern;
f>>match>>pattern;
size_t last;
for (last=pattern.find(match);last!=string::npos;++counter,last=pattern.find(match,last+1)){
if (counter<1000)
pos.push_back(last);
}
t<<counter<<'\n';
for (auto i:pos)
t<<i<<" ";
return 0;
}