Snap | phone | print indentation correctly

Saw this in one of the post and stumble to solve it correctly.
Given a string "(hello word (bye bye))"
Need to print:

(
    hello
	word
	(
		bye
		bye
	)
)
Comments (18)