summaryrefslogtreecommitdiff
path: root/1_anno/Programmazione_2/exercises/sottosequenza.cc
blob: 1d7c4810f32ed0e47c663c38548f03f8f8303db4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<iostream>
#include<fstream>

using namespace std;

int main() {
    ifstream in("input.txt");
    ofstream out("output.txt");

    for(int ts = 0; ts < 100; ++ts) {
        int n; string s;
        in >> n >> s;
        string tm;
        for(int i = 0; i < n; ++i) {
            in >> tm;
            if(tm.find(s) != string::npos)
                out << tm << ' ';
        }
        out << '\n';
    }

    in.close();
    out.close();

    return 0;
}