1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#! /usr/bin/env perl6 unit sub MAIN (Str $alphabet, Str $string, :$verbose); my $count = 0; for $alphabet.comb.unique -> $letter { my $current = $string.comb.grep(* eq $letter).elems; $count += $current; say "$letter: $current" if $verbose; } say $count;