summary refs log tree commit diff homepage
path: root/2020/day02.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--2020/day02.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/2020/day02.c b/2020/day02.c
new file mode 100644
index 0000000..597efde
--- /dev/null
+++ b/2020/day02.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
+int main(void) {
+	int valid = 0;
+	int l, u;
+	char c, p[256];
+	while (EOF != scanf("%d-%d %c: %s\n", &l, &u, &c, p)) {
+		int n = 0;
+		for (int i = 0; p[i]; ++i) {
+			if (p[i] == c) n++;
+		}
+		if (n >= l && n <= u) valid++;
+	}
+	printf("%d\n", valid);
+}
ogsubject'>Always increase unreadLinesJune McEnroe So that if you switch to a window and some new activity happens before you press M-u, it'll still jump to the right place. 2020-02-10Move scroll marker on resizeJune McEnroe 2020-02-10Update line count for words longer than linesJune McEnroe 2020-02-10Simplify mark, heat, unread trackingJune McEnroe 2020-02-10Update prompt when own nick changesJune McEnroe 2020-02-10Match URLs surrounded by parenthesesJune McEnroe But include a pair of parentheses in the URL itself. 2020-02-10Fix M-a so it properly cycles back to where it startedJune McEnroe 2020-02-09Add M-lJune McEnroe 2020-02-09Add /whoisJune McEnroe 2020-02-09Add /msgJune McEnroe