Indent Ruby
Practice
2.2 (6 votes)
Ad Hoc
Medium
Stacks
Problem
58% Success 651 Attempts 30 Points 5s Time Limit 256MB Memory 1024 KB Max Code
Write your program in Ruby which takes an un-indented Ruby code as string and outputs the indented Ruby code as string.
Input Format A string which is un-indented Ruby code
Output Format A string which is indented Ruby code
Sample Input
class YabbaDabbaDoo def foo if foo == 42 puts 'world hello' elsif foo == 24 puts 'bk201' else puts 'congrats!' end end end
Sample Output
class YabbaDabbaDoo def foo if foo == 42 puts 'world hello' elsif foo == 24 puts 'bk201' else puts 'congrats!' end end end
Explanation
Indentation is of 2 spaces.
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
Points:30
20 votes
Tags:
Basic ProgrammingBasics of ImplementationImplementationMedium
Points:30
11 votes
Tags:
Basic ProgrammingBasics of ImplementationImplementaionImplementationMedium
Points:30
9 votes
Tags:
Basic ProgrammingBasics of ImplementationImplementationMediumSortingTwo pointer
Editorial
No editorial available for this problem.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor