package hackerrank;

import java.util.Scanner;

/**
 * https://www.hackerrank.com/challenges/gem-stones
 */
public class Gamestones {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // TODO:
    }
}

@@ -35,210 +35,1231 @@
 til.
-Scanner;%0A%0A/**%0A * https://www.hackerrank.com/challenges/gem-stones%0A */%0Apublic class Gamestones %7B%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        // TODO:
+ArrayList;%0Aimport java.util.HashSet;%0Aimport java.util.List;%0Aimport java.util.Scanner;%0Aimport java.util.Set;%0A%0A/**%0A * https://www.hackerrank.com/challenges/gem-stones%0A */%0Apublic class Gamestones %7B%0A    private static int gemstones(String%5B%5D gems) %7B%0A        int result = 0;%0A        List%3CSet%3CCharacter%3E%3E gemSets = new ArrayList%3C%3E();%0A        for (String gem : gems) %7B%0A            Set%3CCharacter%3E set = new HashSet%3C%3E();%0A            char%5B%5D chars = gem.toCharArray();%0A            for (int i = 0; i %3C chars.length; i++) %7B%0A                set.add(chars%5Bi%5D);%0A            %7D%0A            gemSets.add(set);%0A        %7D%0A        for (char c = 'a'; c %3C= 'z'; c++) %7B%0A            int count = 0;%0A            for (Set%3CCharacter%3E set : gemSets) %7B%0A                if (set.contains(c)) %7B%0A                    count++;%0A                %7D%0A            %7D%0A            if (count == gems.length) %7B%0A                result++;%0A            %7D%0A        %7D%0A        return result;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Scanner in = new Scanner(System.in);%0A        int n = in.nextInt();%0A        String%5B%5D gems = new String%5Bn%5D;%0A        for (int i = 0; i %3C n; i++) %7B%0A            gems%5Bi%5D = in.next();%0A        %7D%0A        System.out.println(gemstones(gems));
 %0A   

Solve Gemstones