summaryrefslogtreecommitdiff
path: root/1_anno/Programmazione_2/exercises/inizia-con.cc
blob: 97f0c3985b9ee4e1c0a3a33dda3a31053b0799de (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
27
28
29
30
31
32
33
#include<iostream>
#include<string>
#include<fstream>

using namespace std;

string result(string s, char c) {
    if(s.at(0) == c)
        return s + ' ';

    return "";
}

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

    for(int ts = 0; ts < 100; ++ts) {
        int _;
        string s;
        char c;
        in >> c;
        for(int i = 0; i < 3; ++i) {
            in >> _ >> s;
            out << result(s, c);
        }
        out << '\n';
    }

    in.close();
    out.close();
    return 0;
}