Cod sursa(job #1915652)
Utilizator | Data | 8 martie 2017 21:56:09 | |
---|---|---|---|
Problema | Potrivirea sirurilor | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include<bits/stdc++.h>
using namespace std;
int x,p=-1,i;
vector<int>s;
string a,b,z="strmatch.";
int main()
{
ifstream f(z+"in");
f>>a>>b;
while(1)
{
p=b.find(a,p+1);
if(p<0)break;
x++;
if(x<1001)s.push_back(p);
}
ofstream g(z+"out");
g<<x<<"\n";
for(i; i<min(x,1000); i++)g<<s[i]<<" ";
}