Cod sursa(job #1121467)

Utilizator cristi103tiron cristian cristi103 Data 25 februarie 2014 12:55:52
Problema Potrivirea sirurilor Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.5 kb
#include<fstream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
ifstream f ("strmatch.in");
ofstream g ("strmatch.out");
string A,B;
int a,b,i,j,k=0,c,ok;
vector<int> v(2000002);
int main ()
{
	getline(f,A);
	getline(f,B);
	a=A.length();
	b=B.length();
	ok=1;
	for (i=0;i<a;++i)
	if (B[i]==A[1])
{	c=i;
	for (j=1;j<b;j++)
	{
	
		if (B[i+j]!=A[j])
		ok=0;
	}
	if (ok)
{	v[k]=c;
	++k;
}}
	g<<k<<'\n';
for (i=0;i<=k;i++)
	g<<v[i]<<" ";
	return 0;
	

}