package com.codegym.task.task10.task1012;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
/*
Number of letters
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// Alphabet
String abc = "abcdefghijklmnopqrstuvwxyz";
char[] abcArray = abc.toCharArray();
ArrayList<Character> alphabet = new ArrayList<>();
for (char letter : abcArray) {
alphabet.add(letter);
}
// Read in strings
ArrayList<String> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
String s = reader.readLine();
list.add(s.toLowerCase());
}
HashMap<Character, Integer> cap = new HashMap<Character, Integer>();
for(int i=0;i<26;i++){
cap.put(abcArray[i],0);
}
//System.out.print(cap);
for(int j=0;j<10;j++){
String str =list.get(j);
for(int x=0;x<str.length();x++){
char c=str.charAt(x);
cap.put(c, cap.get(c) + 1);
}
}
for ( char key : cap.keySet() ) {
System.out.println( key +" "+cap.get(key));
}
//System.out.print(cap);
// write your code here
}
}
package com.codegym.task.task10.task1012;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
/*
Number of letters
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// Alphabet
String abc = "abcdefghijklmnopqrstuvwxyz";
char[] abcArray = abc.toCharArray();
ArrayList<Character> alphabet = new ArrayList<>();
for (char letter : abcArray) {
alphabet.add(letter);
}
// Read in strings
ArrayList<String> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
String s = reader.readLine();
list.add(s.toLowerCase());
}
HashMap<Character, Integer> cap = new HashMap<Character, Integer>();
for(int i=0;i<26;i++){
cap.put(abcArray[i],0);
}
//System.out.print(cap);
for(int j=0;j<10;j++){
String str =list.get(j);
for(int x=0;x<str.length();x++){
char c=str.charAt(x);
cap.put(c, cap.get(c) + 1);
}
}
for ( char key : cap.keySet() ) {
System.out.println( key +" "+cap.get(key));
}
//System.out.print(cap);
// write your code here
}
}