36 lines
672 B
Bash
36 lines
672 B
Bash
#!/usr/bin/env bash
|
|
|
|
score=0
|
|
# converts the word to lowercase
|
|
word=$(echo $1 | tr '[:upper:]' '[:lower:]')
|
|
for (( i=0; i<${#word}; i++ )); do
|
|
letter=${word:i:1}
|
|
case $letter in
|
|
[aeioulnrst])
|
|
score=$((score+1))
|
|
;;
|
|
[dg])
|
|
score=$((score+2))
|
|
;;
|
|
[bcmp])
|
|
score=$((score+3))
|
|
;;
|
|
[fhvwy])
|
|
score=$((score+4))
|
|
;;
|
|
[k])
|
|
score=$((score+5))
|
|
;;
|
|
[jx])
|
|
score=$((score+8))
|
|
;;
|
|
[qz])
|
|
score=$((score+10))
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
done
|
|
|
|
echo $score
|