Skip to main content
5 of 6
added 6 characters in body
Dion
  • 4k
  • 12
  • 42

MAWP, 34 33 24 23 bytes

`|_=M0=A0/[M%{0:.}?`]1:

Try it!

Explanation:

`        Remove starting 1 on stack
|        Push input on stack as ASCII codes
_=M      Set variable M to length of stack (length of input)
0=A      Set variable A to 0
0/       Push 0 and cycle stack
[        Start of loop
M%       Modulo by M
{0:.}    If not 0 then print 0 and terminate
?`       If 0 then pop value
]        End of loop
1:       Print 1
Dion
  • 4k
  • 12
  • 42