Cod sursa(job #645234)

Utilizator the_snyper06FMI - ALexandru Mihai the_snyper06 Data 8 decembrie 2011 21:13:27
Problema Potrivirea sirurilor Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include<cstdio>
#include<string>
#include<vector>

using namespace std;
string str1, str2;
vector <int> L;
size_t found;
char s[2000001];

int main() {
	
	freopen("strmatch.in", "r", stdin), freopen("strmatch.out", "w", stdout);
	scanf("%s", s), str1 = s; scanf("%s", s), str2 = s;
	
	found = str2.find(str1);
	while(found != string::npos) {
		L.push_back(int(found));
		found = str2.find(str1, found + 1);
	}
	
	printf("%d\n", L.size());
	for(int i = 0; i < int(L.size()); i++)
		printf("%d ", L[i]);
	printf("\n");
	
	return 0;
}