about summary refs log tree commit diff
path: root/day09.cc
blob: 61b73d34f7cf5707c27a126aa47213fa27070d93 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>

using namespace std;

int
main()
{
	char c;
	int l{0}, t{0}, g{0};

	while (cin >> c)
		if (c == '{') l++;
		else if (c == '}') t += l--;
		else if (c == '<')
			while (cin >> c && c != '>')
				c == '!' ? cin.get() : g++;

	cout << t << endl << g << endl;   // 17390 7825
}