about summary refs log tree commit diff
path: root/day09.cc
diff options
context:
space:
mode:
Diffstat (limited to 'day09.cc')
-rw-r--r--day09.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/day09.cc b/day09.cc
new file mode 100644
index 0000000..61b73d3
--- /dev/null
+++ b/day09.cc
@@ -0,0 +1,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
+}