Petra Lamborn 1 year ago
parent
commit
0cc5c591e2
2 changed files with 2095 additions and 0 deletions
  1. 16
    0
      6.R
  2. 2079
    0
      input6.txt

+ 16
- 0
6.R View File

@@ -0,0 +1,16 @@
1
+library(stringr)
2
+library(dplyr)
3
+input <- readLines("input6.txt")
4
+ig <- paste0(input, collapse = "\n") %>% str_split("\n\n") %>% unlist()
5
+
6
+igt <- ig %>% str_replace_all("\n", "")
7
+qans <- sapply(letters, function(l) {str_count(igt, l) > 0})
8
+sum(rowSums(qans))
9
+sum(qans) #or actually...
10
+
11
+tans <- sapply(letters, function(l) {str_count(igt, l)})
12
+
13
+numpg <- str_count(ig, "\n") + 1
14
+
15
+qtans <- apply(tans, 2, function(x) {x == numpg})
16
+sum(qtans)

+ 2079
- 0
input6.txt
File diff suppressed because it is too large
View File