Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
#Perl 5, 68 bytes
67, plus 1 for -pe instead of -e
-pe
-e
y/0/ /;$_<${[sort@a]}[-1]&&y/1/0/for@a=split/\b/;$_=join"",@a;y; ;0
Expects and prints a string (concatenation) of 0s and 1s.
#Perl 5, 6968 bytes
6867, plus 1 for -pe instead of -e
y/0/ /;$_<${[sort@a]}[-1]&&y/1/0/for@a=split/\b/;$_=join"",@a;y/@a;y; /0/;0
#Perl 5, 69 bytes
68, plus 1 for -pe instead of -e
y/0/ /;$_<${[sort@a]}[-1]&&y/1/0/for@a=split/\b/;$_=join"",@a;y/ /0/