목록algorithm👨💻 (2)
EEALL@ONCE
문제 : 알파벳 대소문자로 된 단어가 주어지면, 이 단어에서 가장 많이 사용된 알파벳이 무엇인지 알아내는 프로그램을 작성하시오. 단, 대문자와 소문자를 구분하지 않는다. 나의 답 : import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); String line= s.nextLine().toUpperCase(); HashMap count= new HashMap(); for(int i=0; imostCount){ mostCommon=entry.getKey(); mostCount=entry.getValue(); } } int check=0; for(Map.En..
Try : import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); int a = 1; // 결과 변수, 팰린드롬이 맞으면 1, 아니면 0 String word = new String(); word = s.toString(); // 입력을 문자열로 변환하는 부분 // 입력된 문자열을 팰린드롬인지 확인하는 반복문 for (int j = 0; j < word.length() / 2; j++) { if (word.charAt(j) == word.charAt(word.length() - j - 1)) { continue; // 문자가 일치하면 다음 문..