0) $str = $ones[$x] . " hundred"; // do ones and tens if ($y < 20) $str .= $ones[$y]; else $str .= $tens[(int) ($y / 10)] . $ones[$y % 10]; // add triplet modifier only if there // is some output to be modified... if ($str != "") $str .= $triplets[$tri]; // continue recursing? if ($r > 0) return convertTri($r, $tri+1).$str; else return $str; } // returns the number as an anglicized string function convertNum($num) { $num = (int) $num; // make sure it's an integer if ($num < 0) return "negative".convertTri(-$num, 0); if ($num == 0) return "zero"; return convertTri($num, 0); } while($l=intval(fgets(STDIN))) { echo ltrim(convertNum($l))."\n"; } ?>