Pagini recente » Cod sursa (job #1955161) | Cod sursa (job #771117) | Cod sursa (job #643667) | Cod sursa (job #1517431) | Cod sursa (job #3212208)
// ConsoleApplication2.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <fstream>
#include <vector>
#include <string>
using namespace std;
ifstream cin("strmatch.in");
ofstream cout("strmatch.out");
string A, B;
int pos;
vector <int> app;
int main() {
cin >> A >> B;
if (A.size() > B.size()) {
cout << 0;
return 0;
}
pos = B.find(A);
while (pos != string::npos)
{
app.push_back(pos);
pos = B.find(A, pos + 1);
}
cout << app.size() << "\n";
if(app.size() < 1000)
for(int i=0;i<app.size();i++)
cout << app[i] << " ";
else
for (int i = 0; i < 1000; i++)
cout << app[i] << " ";
return 0;
}