반응형
250x250
Notice
Recent Posts
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
관리 메뉴

코딩연습장

정올 - 문자열2-자가진단8 #609 [Java, Python] 본문

정올

정올 - 문자열2-자가진단8 #609 [Java, Python]

감귤짱 2024. 5. 19. 09:00
728x90
반응형

문자열2-자가진단8 #609

 

[ 문제 ]

세 개의 단어를 입력받아 아스키코드(사전) 순으로 가장 먼저 나오는 단어를 출력하는 프로그램을 작성하시오.
각 단어의 길이는 1이상 20 이하이다.

 

[ 예제 ]

입력

cat dog cow

출력

cat

 

[ 출처 ]

자기주도C언어프로그래밍

 

728x90
반응형
 

 

Java

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] arr = new String[3];
        for(int i=0;i<arr.length;i++) {
            arr[i] = sc.next();
        }
        Arrays.sort(arr);
        System.out.println(arr[0]);
    }
}

 

 

Python

lst = list(input().split())
lst.sort()
print(lst[0])

 

 

 

https://jungol.co.kr/problem/609

 

문제 - JUNGOL

history 최근 본 문제

jungol.co.kr

 

728x90
반응형