@@ -0,0 +1,1760 @@
+import java.io.*;%0Aimport java.math.*;%0Aimport java.security.*;%0Aimport java.text.*;%0Aimport java.util.*;%0Aimport java.util.concurrent.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A%0A    // Complete the gemstones function below.%0A    static int gemstones(String%5B%5D arr) %7B%0A        int n = arr%5B0%5D.length();%0A        Set%3CCharacter%3E hs = new HashSet%3CCharacter%3E();%0A        for(int i=0;i%3Cn;i++)%7B%0A            System.out.println(arr%5B0%5D.charAt(i));%0A            hs.add(arr%5B0%5D.charAt(i));%0A        %7D%0A        System.out.println(%22%22);%0A        Stack%3CCharacter%3E st = new Stack%3CCharacter%3E();%0A        for(int i=1;i%3Carr.length;i++)%7B%0A            String s = arr%5Bi%5D;%0A            System.out.println(s);%0A            try%7B%0A                for(char c : hs)%7B%0A                    if(s.indexOf(c)%3E=0) continue;%0A                    else %7B%0A                        System.out.println(c);%0A                        st.push(c);%0A                    %7D%0A                %7D%0A            %7D%0A            catch(Exception e)%7B%7D%0A        %7D%0A        while(st.size()%3E0) hs.remove(st.pop());%0A        return hs.size();%0A    %7D%0A%0A    private static final Scanner scanner = new Scanner(System.in);%0A%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv(%22OUTPUT_PATH%22)));%0A%0A        int n = scanner.nextInt();%0A        scanner.skip(%22(%5Cr%5Cn%7C%5B%5Cn%5Cr%5Cu2028%5Cu2029%5Cu0085%5D)?%22);%0A%0A        String%5B%5D arr = new String%5Bn%5D;%0A%0A        for (int i = 0; i %3C n; i++) %7B%0A            String arrItem = scanner.nextLine();%0A            arr%5Bi%5D = arrItem;%0A        %7D%0A%0A        int result = gemstones(arr);%0A%0A        bufferedWriter.write(String.valueOf(result));%0A        bufferedWriter.newLine();%0A%0A        bufferedWriter.close();%0A%0A        scanner.close();%0A    %7D%0A%7D%0A

add GemStones.java