Post History
Perl, 28 bytes Takes input as newline-separated list of binary strings. perl -ple's/11+//g;$_=y/1//' -p - assign each line of input to $_, manipulate, then print -l - strip trailing newline...
#4: Post edited
- Perl, 28 bytes
- ---
Take input as binary string.- ```perl
- perl -ple's/11+//g;$_=y/1//'
- ```
- * `-p` - assign each line of input to `$_`, manipulate, then print
- * `-l` - strip trailing newline from input, add back to output
- * `-e` - program follows
- * `s/11+//g` - strip runs of two or more 1s
- * `y/1//` - count remaining 1s, assign to `$_`
- Perl, 28 bytes
- ---
- Takes input as newline-separated list of binary strings.
- ```perl
- perl -ple's/11+//g;$_=y/1//'
- ```
- * `-p` - assign each line of input to `$_`, manipulate, then print
- * `-l` - strip trailing newline from input, add back to output
- * `-e` - program follows
- * `s/11+//g` - strip runs of two or more 1s
- * `y/1//` - count remaining 1s, assign to `$_`
#3: Post edited
- Perl, 28 bytes
- ---
- Take input as binary string.
- ```perl
- perl -ple's/11+//g;$_=y/1//'
- ```
- * `-p` - assign each line of input to `$_`, manipulate, then print
- * `-l` - strip trailing newline from input, add back to output
- * `-e` - program follows
* `s///g` - strip runs of two or more 1s* `y///` - count remaining 1s, assign to `$_`
- Perl, 28 bytes
- ---
- Take input as binary string.
- ```perl
- perl -ple's/11+//g;$_=y/1//'
- ```
- * `-p` - assign each line of input to `$_`, manipulate, then print
- * `-l` - strip trailing newline from input, add back to output
- * `-e` - program follows
- * `s/11+//g` - strip runs of two or more 1s
- * `y/1//` - count remaining 1s, assign to `$_`
#2: Post edited
Perl, 31 bytes- ---
- Take input as binary string.
- ```perl
perl -ple's/11+|0+//g;$_=y/1//'- ```
- * `-p` - assign each line of input to `$_`, manipulate, then print
- * `-l` - strip trailing newline from input, add back to output
- * `-e` - program follows
* `s///g` - strip all runs of 0s or two or more 1s- * `y///` - count remaining 1s, assign to `$_`
- Perl, 28 bytes
- ---
- Take input as binary string.
- ```perl
- perl -ple's/11+//g;$_=y/1//'
- ```
- * `-p` - assign each line of input to `$_`, manipulate, then print
- * `-l` - strip trailing newline from input, add back to output
- * `-e` - program follows
- * `s///g` - strip runs of two or more 1s
- * `y///` - count remaining 1s, assign to `$_`
#1: Initial revision
Perl, 31 bytes --- Take input as binary string. ```perl perl -ple's/11+|0+//g;$_=y/1//' ``` * `-p` - assign each line of input to `$_`, manipulate, then print * `-l` - strip trailing newline from input, add back to output * `-e` - program follows * `s///g` - strip all runs of 0s or two or more 1s * `y///` - count remaining 1s, assign to `$_`
