AC 

Solution for Gem Stones at HackerRank