s=' '*6+input()exec"s=s[1:]+('1'+s)[sum(s[i]<'1'for i in[-6,-1,1,6])>2or'/'>s];"*980print s[6:]
"11001\n00000\n01001\n00000\n10001"
11001 11001 11001 11001 11001
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!