Skip to main content
-4 bytes thx to @Night2!
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61

PHP, 58 56 bytes

function f($s){return!$s?:$s[0]==$s[1]&f(substr($s,2));} 

Try it online!

As a recursive function.

PHP, 61 5656 52 bytes

foreach(str_splitwhile($argn,2)as$a''<$l=$argn[$i++])$r|=$a[0]$r|=$l!=$a[1];echo=$argn[$i++];echo!$r; 

Try it online!Try it online!

Or standalone program. Input string via STDIN, output is truthy (1) if it is double speak, and falsey (0) if it is not double speak.

-4 bytes thx to @Night2!

PHP, 58 56 bytes

function f($s){return!$s?:$s[0]==$s[1]&f(substr($s,2));} 

Try it online!

As a recursive function.

PHP, 61 56 bytes

foreach(str_split($argn,2)as$a)$r|=$a[0]!=$a[1];echo!$r; 

Try it online!

Or standalone program. Input string via STDIN, output is truthy (1) if it is double speak, and falsey (0) if it is not double speak.

PHP, 58 56 bytes

function f($s){return!$s?:$s[0]==$s[1]&f(substr($s,2));} 

Try it online!

As a recursive function.

PHP, 61 56 52 bytes

while(''<$l=$argn[$i++])$r|=$l!=$argn[$i++];echo!$r; 

Try it online!

Or standalone program. Input string via STDIN, output is truthy (1) if it is double speak, and falsey (0) if it is not double speak.

-4 bytes thx to @Night2!

-2 bytes for recursive
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61

PHP, 58 56 bytes

function f($s){return!$s?:$s[0]==$s[1]&f(substr($s,2));} 

Try it online!

As a recursive function.

PHP, 61 56 bytes

foreach(str_split($argn,2)as$a)$r|=$a[0]!=$a[1];echo!$r; 

Try it online!Try it online!

InputOr standalone program. Input string via STDIN, output is truthy (1) if it is double speak, and falsey (0) if it is not double speak.

PHP, 58 bytes

Or recursive:

function f($s){return$s?$s[0]==$s[1]?f(substr($s,2)):0:1;} 

Try it online!

PHP, 61 56 bytes

foreach(str_split($argn,2)as$a)$r|=$a[0]!=$a[1];echo!$r; 

Try it online!

Input string via STDIN, output is truthy (1) if it is double speak, and falsey (0) if it is not double speak.

PHP, 58 bytes

Or recursive:

function f($s){return$s?$s[0]==$s[1]?f(substr($s,2)):0:1;} 

Try it online!

PHP, 58 56 bytes

function f($s){return!$s?:$s[0]==$s[1]&f(substr($s,2));} 

Try it online!

As a recursive function.

PHP, 61 56 bytes

foreach(str_split($argn,2)as$a)$r|=$a[0]!=$a[1];echo!$r; 

Try it online!

Or standalone program. Input string via STDIN, output is truthy (1) if it is double speak, and falsey (0) if it is not double speak.

add recursive answer
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61

PHP, 61 56 bytes

foreach(str_split($argn,2)as$a)$r|=$a[0]!=$a[1];echo!$r; 

Try it online!

Input string via STDIN, output is truthy (1) if it is double speak, and falsey (0) if it is not double speak.

PHP, 58 bytes

Or recursive:

function f($s){return$s?$s[0]==$s[1]?f(substr($s,2)):0:1;} 

Try it online!

PHP, 61 56 bytes

foreach(str_split($argn,2)as$a)$r|=$a[0]!=$a[1];echo!$r; 

Try it online!

Input string via STDIN, output is truthy (1) if it is double speak, and falsey (0) if it is not double speak.

PHP, 61 56 bytes

foreach(str_split($argn,2)as$a)$r|=$a[0]!=$a[1];echo!$r; 

Try it online!

Input string via STDIN, output is truthy (1) if it is double speak, and falsey (0) if it is not double speak.

PHP, 58 bytes

Or recursive:

function f($s){return$s?$s[0]==$s[1]?f(substr($s,2)):0:1;} 

Try it online!

-5 bytes, shorter, less buggy approach
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading
Rollback to Revision 4
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading
-7 bytes, shorter, less buggy approach
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading
+1 byte single char input bug
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading
fix check for last group, return 1 for true, 0 for false
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading
added 208 characters in body
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading