Advertisement
PandaDoddo72Rus

test

Jul 4th, 2022
717
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function a(string $str): bool {
  4.     preg_match_all('/[1]{1,}/', $str, $match1);
  5.     preg_match_all('/[0]{1,}/', $str, $match0);
  6.    
  7.     sort($match1[0], SORT_STRING);
  8.     sort($match0[0], SORT_STRING);
  9.  
  10.     return mb_strlen(array_reverse($match1[0])[0] ?? '') > mb_strlen(array_reverse($match0[0])[0] ?? '');
  11. }
  12.  
  13. var_dump(a('1010')); // false
  14.  
  15. var_dump(a('1010111000100011111')); // true
  16.  
  17. var_dump(a('100')); // false
Advertisement
RAW Paste Data Copied
Advertisement