Hackerrank: Gem stones - https://www.hackerrank.com/challenges/gem-stones