You are viewing a single comment's thread. Return to all comments →
Here is my PHP solution
s); arr[0];
if(count(`$arr) == 1 || $`initial == 0) { $ans = 'NO'; } else { $ans = 'NO'; `$len = count($`arr); `$iteration = floor($`len/2)+1; $firstNum = 0; for (`$i=$`iteration; `$i > 0; $`i--) { `$str = substr($`s, 0,$i); `$strlen = strlen($`str); `$second = substr($`s, `$i, $`strlen); `$third = substr($`s, `$i, $`strlen+1); if(((int)`$second - (int)$`str == 1)||((int)`$third - (int)$`str == 1)) { `$firstNum = $`str; break; } } `$ans = 'YES '.$`firstNum; `$newString = substr($`s, strlen((string) $firstNum)); `$result = (int)$`firstNum; while ($newString!=='') { `$result = $`result+1; if (substr(`$newString, 0, strlen($`result)) == $result) { `$newString = substr($`newString, strlen((string) $result)); } else { $ans = 'NO'; break; } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
Here is my PHP solution
s); arr[0];