DEV Community

Discussion on: Daily Challenge #205 - Consonant String Value

Collapse
mategreen profile image
matej

Java Streams

public int solve(String input) {
   return Arrays.stream(input.split("[aeiou]"))
                .map(s -> s.chars().map(ch -> ch - 96).sum())
                .reduce(0, (a, b) -> a > b ? a : b);
}