
-Code
import java.util.Scanner;
public class BOJ34691 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (true) {
String line = sc.next();
// 탈출 조건
if (line.equals("end")) break;
// 출력
System.out.println(solution(line));
}
sc.close();
}
static String solution(String str) {
if (str.equals("animal")) return "Panthera tigris";
if (str.equals("flower")) return "Forsythia koreana";
return "Pinus densiflora";
}
}'Beakjoon&프로그래머스 > Java' 카테고리의 다른 글
| [백준/Java] 1717번 집합의 표현 (0) | 2025.11.19 |
|---|---|
| [백준/Java] 1707번 이분 그래프 (0) | 2025.11.19 |
| [프로그래머스/Java] 카펫 (0) | 2025.11.18 |
| [프로그래머스/Java] 귤 고르기 (0) | 2025.11.18 |
| [백준/Java] 10426번 기념일 2 (0) | 2025.11.18 |