summaryrefslogtreecommitdiff
path: root/Year_1/Programming_2/exercises/estremi-uguali.cc
blob: 63ac0193a7e20405861cd55fa023fd53f331098c (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
#include<iostream>
#include<string>
#include<fstream>

using namespace std;

int result(string s) {
    if(s.at(0) == s.at(s.length()-1))
        return 1;

    return 0;
}

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

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

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