Files
advent-of-code/2015/src/05.c
2025-11-14 07:14:53 -08:00

17 lines
472 B
C

#include <stdio.h>
#include <stdlib.h>
#include <lfinput.h>
void advent2015day05(void) {
/* Sometimes, grep really is the best tool */
const char *p1 = capture_system(
"grep -E \"(.*[aeiou]){3}\" ./input/2015/05 | grep \"\\(.\\)\\1\" | egrep -v \"(ab|cd|pq|xy)\" | wc -l", 0);
const char *p2 = capture_system("grep \"\\(..\\).*\\1\" ./input/2015/05 | grep \"\\(.\\).\\1\" | wc -l", 0);
printf("%s%s", p1, p2);
free(p1);
free(p2);
}