Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

Perl, 27 21 bytes

say grep$_-chop,/../g

Byte added for the -n flag.

                /../g  match groups of two chars
    grep       ,       select/filter on...
           chop        remove the last character, mutating the string
        $_-            is it different than the remaining char?
                         (subtract it, empty string is falsy)
say                    output if so

Test:

llama@llama:~$ perl -nE 'say grep$_-chop,/../g'
1110
1
11000110
01
1100011
0
00

1



1101001
0
1011101010
1111

Thanks to @TonHospel@TonHospel for 6 bytes!

Perl, 27 21 bytes

say grep$_-chop,/../g

Byte added for the -n flag.

                /../g  match groups of two chars
    grep       ,       select/filter on...
           chop        remove the last character, mutating the string
        $_-            is it different than the remaining char?
                         (subtract it, empty string is falsy)
say                    output if so

Test:

llama@llama:~$ perl -nE 'say grep$_-chop,/../g'
1110
1
11000110
01
1100011
0
00

1



1101001
0
1011101010
1111

Thanks to @TonHospel for 6 bytes!

Perl, 27 21 bytes

say grep$_-chop,/../g

Byte added for the -n flag.

                /../g  match groups of two chars
    grep       ,       select/filter on...
           chop        remove the last character, mutating the string
        $_-            is it different than the remaining char?
                         (subtract it, empty string is falsy)
say                    output if so

Test:

llama@llama:~$ perl -nE 'say grep$_-chop,/../g'
1110
1
11000110
01
1100011
0
00

1



1101001
0
1011101010
1111

Thanks to @TonHospel for 6 bytes!

added 134 characters in body
Source Link
Doorknob
  • 71.7k
  • 20
  • 143
  • 385

Perl, 2727 21 bytes

say grep{chop$_ ne$_}grep$_-chop,/../g

Byte added for the -n flag.

                     /../g  match groups of two chars
    grep{           },       select/filter on...
         chop$_     chop        remove the last character, mutating the string
           $_-     ne$_        is it different than the remaining characterchar?
say                         (subtract it, empty string is falsy)
say                    output if so

Test:

llama@llama:~$ perl -nE 'say grep{chop$_ ne$_}grep$_-chop,/../g'
1110
1
11000110
01
1100011
0
00

1



1101001
0
1011101010
1111

Thanks to @TonHospel for 6 bytes!

Perl, 27 bytes

say grep{chop$_ ne$_}/../g

Byte added for the -n flag.

                     /../g  match groups of two chars
    grep{           }       select/filter on...
         chop$_             remove the last character, mutating the string
                ne$_        is it different than the remaining character?
say                         output if so

Test:

llama@llama:~$ perl -nE 'say grep{chop$_ ne$_}/../g'
1110
1
11000110
01
1100011
0
00

1



1101001
0
1011101010
1111

Perl, 27 21 bytes

say grep$_-chop,/../g

Byte added for the -n flag.

                /../g  match groups of two chars
    grep       ,       select/filter on...
           chop        remove the last character, mutating the string
        $_-            is it different than the remaining char?
                         (subtract it, empty string is falsy)
say                    output if so

Test:

llama@llama:~$ perl -nE 'say grep$_-chop,/../g'
1110
1
11000110
01
1100011
0
00

1



1101001
0
1011101010
1111

Thanks to @TonHospel for 6 bytes!

Source Link
Doorknob
  • 71.7k
  • 20
  • 143
  • 385

Perl, 27 bytes

say grep{chop$_ ne$_}/../g

Byte added for the -n flag.

                     /../g  match groups of two chars
    grep{           }       select/filter on...
         chop$_             remove the last character, mutating the string
                ne$_        is it different than the remaining character?
say                         output if so

Test:

llama@llama:~$ perl -nE 'say grep{chop$_ ne$_}/../g'
1110
1
11000110
01
1100011
0
00

1



1101001
0
1011101010
1111