백준 1386번) 도비의 영어 공부(char 대소문자 무시)

하우르·2021년 3월 25일
0
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Character> alphabet_list = new ArrayList<Character>();
		ArrayList<Integer> count_list = new ArrayList<Integer>();
		char alp;
		while(true)
		{
			String str = reader.readLine();
			int count=0;
			if(str.equals("#"))
				break;
			alp = str.charAt(0);
			for(int i=2; i<str.length();i++)
			{
				if(alp-str.charAt(i)==0 || alp-str.charAt(i)==Math.abs(32))
					count++;
			}
			alphabet_list.add(alp);
			count_list.add(count);
		}
		for(int j=0; j<alphabet_list.size();j++)
			System.out.println(alphabet_list.get(j)+" "+count_list.get(j));
		


	}
}
profile
주니어 개발자

0개의 댓글