33 lines
804 B
C++
33 lines
804 B
C++
#include <iostream>
|
|
#include <string>
|
|
#include <algorithm>
|
|
|
|
using namespace std;
|
|
|
|
int main(int argc, char* argv[])
|
|
{
|
|
int total = 0;
|
|
|
|
string line;
|
|
while(getline(cin, line))
|
|
{
|
|
string::size_type n = line.find(',');
|
|
string half1 = line.substr(0,n);
|
|
string half2 = line.substr(n+1);
|
|
|
|
n = half1.find('-');
|
|
int half1_start = stoi(half1.substr(0,n));
|
|
int half1_end = stoi(half1.substr(n+1));
|
|
|
|
n = half2.find('-');
|
|
int half2_start = stoi(half2.substr(0,n));
|
|
int half2_end = stoi(half2.substr(n+1));
|
|
|
|
if ((half1_start <= half2_start && half1_end >= half2_end) ||
|
|
(half2_start <= half1_start && half2_end >= half1_end))
|
|
{
|
|
total++;
|
|
}
|
|
}
|
|
cout << total << endl;
|
|
} |