2019-04: Secure Container
Part 1
s1 <- map(dt, \(password) {
s <- str_split(password, "", simplify = TRUE)
ret1 <- ifelse(all(s == cummax(s)), TRUE, FALSE)
ret2 <- ifelse(!str_detect(password, "(.)\\1"), FALSE, TRUE)
ret <- ifelse(ret1 & ret2, TRUE, FALSE)
return(ret)
}) |>
unlist()
sum(s1)
[1] 1178