@@ -0,0 +1,1181 @@
+import java.io.BufferedReader;%0Aimport java.io.InputStreamReader;%0Aclass magicaljewels %7B%0A    public static void main(String args%5B%5D ) throws Exception %7B%0A    %09%0A         int r=0,u=0,b=0,y=0,strcount1=0;%0A %0A        String st1=%22%22;%0A        String str1%5B%5D=new String%5B80%5D;int i=0;%0A          %0A        %0A    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));%0A        %0A        %0A        int no=Integer.parseInt(in.readLine());  %0A        //System.out.println(no);%0A        for(i=0;i%3Cno;i++)%0A               %7B%0A                 char ch%5B%5D=in.readLine().trim().toCharArray();%0A %0A                for(int j=0;j%3Cch.length;j++)%0A               %7B   %0Aswitch(ch%5Bj%5D)%0A    %7B%0A        case 'r':%0A           r++;%0A     %0A           break;%0A        case 'u':%0A           u++;%0A           break;%0A        case 'b':%0A           b++;%0A           break;%0A        case 'y':%0A           y++;%0A           break;%0A            %0A%7D%0Aif(r!=0 && u!=0 && b!=0 && y!=0)%0A    %7B%0A        strcount1++;%0A        r--;u--;b--;y--;%0A    %7D%0A str1%5Bi%5D=%22%22+strcount1;%0A               %7D%0A                 strcount1=r=u=b=y=0;%0A%7D%0A               for(i=0;i%3Cno;i++)%0A               %7B%0A           System.out.println(str1%5Bi%5D);%0A               %7D%0A        %7D%0A%7D%0A

Create magicaljewels.java