Banner

My Tech Blog (구하기)

오늘의 명언
" 신은 인생에서 최고의 것들을 항상 두려움 뒤에 놓습니다. "
- 윌 스미스 (영화 배우)
✅ 문제✅ 코드public class bonus02 { public static void main(String[] args) { System.out.println(getMiddle("123456789")); } public static String getMiddle(String wrd) { int center = wrd.length() / 2 + 1; String result; if (wrd.length() % 2 == 0) { result = wrd.substring(center - 2, center); } else { result = wrd.substring(center - 1, center); } return result; }} 1. getMiddle 메소드는 문자열을 입력으로 ..
✅ 문제입력된 문장에 포함된 알파벳의 빈도를 대소문자 구별없이 구하는 프로그램을 작성하시오. ✅ 코드import java.util.Scanner;public class Main { public static void main(String[] args) { System.out.println("===== 알파벳 빈도수 구하기 ====="); System.out.println("입력 >> "); Scanner sc = new Scanner(System.in); int[] result = new int[26]; String inPut = sc.nextLine().replaceAll(" ", ""); System.out.println(inPut); String outPut = inPut.toLowerC..
상단으로