Sha256: f06d2e6388823f0da894c8e741f8f8774a2e2801024405621b49d11fd83fe01a

Contents?: true

Size: 416 Bytes

Versions: 311

Compression:

Stored size: 416 Bytes

Contents

function score(str::AbstractString)
    rank = Dict('a'=>1, 'e'=>1, 'i'=>1, 'o'=>1, 'u'=>1, 'l'=>1,
                'n'=>1, 'r'=>1, 's'=>1, 't'=>1, 'd'=>2, 'g'=>2,
                'b'=>3, 'c'=>3, 'm'=>3, 'p'=>3, 'f'=>4, 'h'=>4,
                'v'=>4, 'w'=>4, 'y'=>4, 'k'=>5, 'j'=>8, 'x'=>8,
                'q'=>10, 'z'=>10)
    length(str) == 0 && return 0
    mapreduce(x->get(rank, x, 0), +, lowercase(str))
end

Version data entries

311 entries across 311 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.179 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.178 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.177 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.176 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.175 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.174 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.173 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.172 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.171 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.170 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.169 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.167 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.166 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.165 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.164 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.163 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.162 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.161 tracks/julia/exercises/scrabble-score/example.jl
trackler-2.2.1.160 tracks/julia/exercises/scrabble-score/example.jl