DEV Community

Discussion on: Daily Challenge #110 - Love VS. Friendship

Collapse
 
khenhey profile image
Karin

A little solution for Ruby :) this was fun!

def wordsToMarks(word)
  strength = 0
  alphabet = ('a'..'z').to_a
  word.split('').each do |i|
    strength = strength + (alphabet.index(i) + 1)
  end
  return strength
end