Created
December 11, 2017 12:59
-
-
Save felinebabies/f4f8a907959585cded8ae30a42d5847e to your computer and use it in GitHub Desktop.
筒の中のボール
This file contains hidden or 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
| ballCount, ballInput = $stdin.read.split("\n") | |
| ballCount = ballCount.to_i | |
| tube = [] | |
| ballCount.times do |i| | |
| ballNum = i + 1 | |
| ballDirection = ballInput[i] | |
| if ballDirection == "L" | |
| tube.unshift(ballNum.to_s) | |
| elsif ballDirection == "R" | |
| tube.push(ballNum.to_s) | |
| end | |
| end | |
| puts tube.join(" ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment