<?php
$input = 'aaaabbcccff';
$arr = [];
foreach($acv as $key=>$value)
$out = null;
for($i=0; $i<count($arr[0]); $i++) for($j=0; $j<count($arr); $j++) $out.= isset($arr[$j][$i]) ?
$arr[$j][$i] : null;
echo 'Input: '.$input.PHP_EOL.'Out: '.$out;
PD9waHAKJGlucHV0ID0gJ2FhYWFiYmNjY2ZmJzsKJGFjdiA9IGFycmF5X2NvdW50X3ZhbHVlcyhzdHJfc3BsaXQoJGlucHV0KSk7CmFyc29ydCgkYWN2KTsKJGFyciA9IFtdOwpmb3JlYWNoKCRhY3YgYXMgJGtleT0+JHZhbHVlKQogICRhcnJbXSA9IHN0cl9zcGxpdChzdHJfcmVwZWF0KCRrZXksICR2YWx1ZSkpOwokb3V0ID0gbnVsbDsKIGZvcigkaT0wOyAkaTxjb3VudCgkYXJyWzBdKTsgJGkrKykKICBmb3IoJGo9MDsgJGo8Y291bnQoJGFycik7ICRqKyspCiAgICAkb3V0Lj0gaXNzZXQoJGFyclskal1bJGldKSA/ICRhcnJbJGpdWyRpXSA6IG51bGw7CgplY2hvICdJbnB1dDogJy4kaW5wdXQuUEhQX0VPTC4nT3V0OiAnLiRvdXQ7