
-Code
import java.io.*;
import java.util.*;
public class BOJ4368 {
public static void main(String[] args) throws IOException {
BufferedReader br =
new BufferedReader(new InputStreamReader(System.in));
Map<String, String> translation = new HashMap<>();
// 원래 단어와 방언 맵핑
String line;
while (true) {
line = br.readLine();
if (line == null || line.isEmpty()) break;
StringTokenizer st = new StringTokenizer(line);
String val = st.nextToken();
String key = st.nextToken();
translation.put(key, val);
}
// 방언을 받아 결과값 출력
while ((line = br.readLine()) != null) {
String result = translation.get(line);
if (result == null) {
// 방언에 해당하는 언어가 없는 경우
System.out.println("eh");
} else {
System.out.println(result);
}
}
}
}'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
| [프로그래머스/Java] 수식 최대화 (0) | 2026.04.10 |
|---|---|
| [백준/Java] 28345번 Image Filter (0) | 2026.04.10 |
| [프로그래머스/Java] 연속된 부분 수열의 합 (0) | 2026.04.09 |
| [백준/Java] 10176번 Opposite Words (0) | 2026.04.09 |
| [프로그래머스/Java] 큰 수 만들기 (0) | 2026.04.09 |