<?php
function maior($x)
{
$index = -1;
{
if ($ultimo != $x[$i])
{
$ultimocount = $count;
$count = 0;
$ultimo = $x[$i];
}
else
{
$count++;
if ($count > $ultimocount)
}
}
return $index;
}
$n = "abbcccddddeeeeeefffffffffggg";
echo maior($n);
PD9waHAKZnVuY3Rpb24gbWFpb3IoJHgpCnsKICAgICRpbmRleCA9IC0xOwogICAgZm9yICgkaT0wOyRpPHN0cmxlbigkeCk7JGkrKykKICAgIHsKICAgICAgICBpZiAoJHVsdGltbyAhPSAkeFskaV0pCiAgICAgICAgewogICAgICAgICAgICAkdWx0aW1vY291bnQgPSAkY291bnQ7CiAgICAgICAgICAgICRjb3VudCA9IDA7CiAgICAgICAgICAgICR1bHRpbW8gPSAkeFskaV07CiAgICAgICAgfQogICAgICAgIGVsc2UKICAgICAgICB7CiAgICAgICAgICAgICRjb3VudCsrOwogICAgICAgICAgICBpZiAoJGNvdW50ID4gJHVsdGltb2NvdW50KQogICAgICAgICAgICAgICAgJGluZGV4ID0gc3RycG9zKCR4LCAkeFskaV0pOwogICAgICAgIH0KICAgIH0KICAgIHJldHVybiAkaW5kZXg7Cn0KCiRuID0gImFiYmNjY2RkZGRlZWVlZWVmZmZmZmZmZmZnZ2ciOwplY2hvIG1haW9yKCRuKTs=