<?php
fscanf(STDIN,'%s',$S);
$arr = str_split($S);
$count= count($arr);
while (true) {
  // code...

for ($i=0; $i <= count($arr) - 2 ; $i++) {
  // code...
if(isset($arr[$i])){
  if(($arr[$i]=='0'&&$arr[$i+1]=='1')||($arr[$i]=='1'&&$arr[$i+1]=='0')){
    unset($arr[$i]);
    unset($arr[$i+1]);
    }
}
}
$arrB == $arr;
$arrC = array_values($arrB);
if($arrC==$arrB){
  break;
}else{
  $arr == $arrC
}
}
$lastcount = count($arr);
echo $count- $lastcount;

 ?>
