1
0
Fork 0
Advent2021/Day 8/Marcus/cpp/part1.cpp

52 lines
877 B
C++
Raw Normal View History

2021-12-09 03:14:58 +00:00
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
struct Note
{
string patterns[10];
string outputs[4];
friend istream &operator>>( istream &input, Note &n ) {
for(int i = 0; i < 10; i++)
{
input >> n.patterns[i];
}
for(int i = 0; i < 4; i++)
{
input >> n.outputs[i];
}
return input;
}
};
int main()
{
Note note;
int count = 0;
while (cin >> note)
{
for(int i = 0; i < 4; i++)
{
switch(note.outputs[i].size())
{
case 2:
case 3:
case 4:
case 7:
count++;
break;
default:
break;
}
}
}
cout << count << endl;
return 0;
}