# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
584211 | 2022-06-27T04:09:56 Z | Shubham_4070 | Karte (COCI15_karte) | Java 11 | 0 ms | 0 KB |
import java.util.*; public class Main { int suite(char ch){ if(ch=='P')return 0; if(ch=='K')return 1; if(ch=='H')return 2; return 3; } int num(String str){ int res=0; for(int i=0;i<=1;i++) { char ch=str.charAt(i); res=res*10+(ch-'0'); } return res; } public static void main(String[] args) { Scanner ob=new Scanner(System.in); String str=ob.next(); int vis[][]=new int[4][14]; int n=str.length(); for(int i=0;i<n;i+=3){ char ch=str.charAt(i); int st=suite(ch); int m=num(str.substring(i+1,i+3)); if(vis[st][m]==1) { System.out.print("Greeka"); return; } else vis[st][m]=1; } //missing int ans[]=new int[n/3]; for(int i=0;i<=3;i++){ ans[i]=13; for(int j=1;j<=13;j++){ ans[i]=ans[i]-vis[i][j]; } } //print the array for(int i=0;i<ans.length;i++){ System.out.print(ans[i]+" "); } } }