You are viewing a single comment's thread. Return to all comments →
compact java solution
public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); Set<Character> set = new HashSet(); int[] count = new int[26]; for(int i = 0; i < n; i ++) { for(Character c : scan.next().toCharArray()) set.add(c); set.forEach(c -> count[c - 'a'] ++); set.clear(); } int total = 0; for(int i : count) { if(i == n) total ++; } System.out.println(total); }
Seems like cookies are disabled on this browser, please enable them to open this website
Gemstones
You are viewing a single comment's thread. Return to all comments →
compact java solution