Cod sursa(job #415175)

Utilizator pykhNeagoe Alexandru pykh Data 10 martie 2010 23:07:33
Problema Potrivirea sirurilor Scor 38
Compilator cpp Status done
Runda Arhiva educationala Marime 0.42 kb
#include<string>
#include<fstream>
using namespace std;
const char in[]="strmatch.in", out[]="strmatch.out";
ifstream f(in);
ofstream g(out);
string a, b;
int found, nrap, v[1005];
int main()
	{
	f >> a;
	f >> b;
	while(1) {
	found=b.find(a);
	if(found > 0){v[++nrap]=found;b[found]=-1;}
	else break;}
	g << nrap <<'\n';
	for(int i = 1; i <= (nrap > 1000 ? 1000 : nrap); ++i)
	g << v[i] <<' ';
	return 0;
	}