Cod sursa(job #98168)

Utilizator algoritmarOvidiu Andrei algoritmar Data 10 noiembrie 2007 10:39:12
Problema Abc2 Scor 0
Compilator cpp Status done
Runda Happy Coding 2007 Marime 0.46 kb
#include <fstream>

using namespace std;

#define FIN "abc2.in"
#define FOUT "abc2.out"

char a[100],b[100][100];
int c,k;
int main()
{
	int l = 0;
	ifstream fin(FIN);
	ofstream fout(FOUT);

	fin >> a;
	
	for(int i = 0; !fin.eof(); ++i){
		fin >> b[i];
		for(int j = 0; j < strlen(a);++j)
		{
			if(a[j] == b[i][l])
				++k,++l;
			else
				k = 0,l = 0;
			if(k == strlen(b[i])-1)
				++c;
		}
	}

	fout << c << std::endl;
	return 0;
}