-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
<open>tag<close> | ||
2 | ||
I am happy today | ||
We want to win the first prize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
입력값 => 첫째 줄은 개수 | ||
출력값 => 입력값을 모두 뒤집어서 출력하기 | ||
*/ | ||
|
||
const fs = require("fs"); | ||
const file = "/dev/stdin"; | ||
// const file = "../input.txt"; | ||
|
||
function main() { | ||
const input = fs.readFileSync(file).toString().split("\n"); | ||
let result = ""; | ||
|
||
for (let i = 1; i <= input[0]; i++) { | ||
let splitIP = input[i].split(" "); // [ 'I', 'am', 'happy', 'today' ] | ||
|
||
for (let j = 0; j < splitIP.length; j++) { | ||
result += splitIP[j].split("").reverse().join("") + " "; | ||
} | ||
console.log(result); | ||
result = ""; | ||
} | ||
} | ||
|
||
main(); |