Skip to content

Instantly share code, notes, and snippets.

@pastak
Created March 31, 2010 14:38
Show Gist options
  • Save pastak/350407 to your computer and use it in GitHub Desktop.
Save pastak/350407 to your computer and use it in GitHub Desktop.
<?php
$i=$argv[1];
if($i<10){
echo"10以上の数値を入力して下しあ";
exit;
}
for($a=0;$a<$argv[2];$a++){
if(!$a==0){
echo",";
}
echo$i;
$n=0;
$ans="";
for($j=0;$j<strlen($i);$j++){
$counter[$n][0]=$i[$j];
$counter[$n][1]=1;
$k=$j+1;
if($k>strlen($i)){
break;
}
while($i[$j]==$i[$k]){
$counter[$n][1]++;
$j++;
$k++;
}
$ans=$ans.$counter[$n][0].$counter[$n][1];
}
$i=$ans;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment