단어 여러 개가 한 줄에 입력됩니다. 길이 4 이하와 5 이상으로 분류해 각각 오름차순으로 출력하세요.
📥 테스트 입력값
hi python java go programming
🔎 실행 결과
go hi java
python programming
💡 힌트 코치
두 리스트로 나눠 각각 정렬하세요.
✅ 정답 공개
words = input().split()
short = sorted([w for w in words if len(w) <= 4])
long_ = sorted([w for w in words if len(w) >= 5])
print(*short)
print(*long_)