Cod sursa(job #415191)

Utilizator pykhNeagoe Alexandru pykh Data 10 martie 2010 23:25:09
Problema Potrivirea sirurilor Scor 14
Compilator cpp Status done
Runda Arhiva educationala Marime 0.38 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, j;
char v[200005];
int main()
	{
	f >> a;
	f >> b;
	while(1) {
	found=b.find(a);
	if(found >= 0){v[j++]=found + '0';v[j++]=' ';++nrap;b[found]=-1;}
	else break;}
	g << nrap <<'\n'<<v;
	return 0;
	}