HACKERRANK - Gem Stones

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