(1).백준 5363번 요다는 가장 앞 두 단어를 뒤에 말하는 이상한 규칙을 가진 문제로

slice를 활용해서 뒤로 빼는 방식으로 처리해줬다.

 

const input = `4
I will go now to find the Wookiee
Solo found the death star near planet Kessel
I'll fight Darth Maul here and now
Vader will find Luke before he can escape`.split('\n').map(el => el.split(' '))

for(let i = 1 ; i < input.length ; i++){
    console.log(input[i].slice(2).join(' '), input[i].slice(0,2).join(' '))
}

'회고' 카테고리의 다른 글

[개발일지] - 894  (0) 2025.12.22
[개발일지] - 893(주말)  (0) 2025.12.22
[개발일지] - 891  (0) 2025.12.20
[개발일지] - 890(연차)  (0) 2025.12.19
[개발일지] - 889  (0) 2025.12.18

+ Recent posts