PHP,138字节
echo ucfirst($a=$argv[1]).'s go M'.(($n=substr_count($a,'a'))?str_repeat('e',$n).str_repeat('o',$n).'w':str_repeat('oo',substr_count($a,'o')));
可读性:
echo ucfirst($a = $argv[1]) . 's go M'. (
($n = substr_count($a, 'a'))
? str_repeat('e', $n) . str_repeat('o', $n) . 'w'
: str_repeat('oo', substr_count($a, 'o'))
);
尝试了更短但在PHP中无法正常工作:
#too long -- echo ucfirst($s=$argv[1]).'s go M'.(($o='o'and$n=substr_count($s,'a'))?str_repeat('e',$n).str_repeat($o,$n).'w':str_repeat('oo',substr_count($s,$o)));
#too long -- echo ucfirst($s=$argv[1]).'s go M'.(($o='o'and$f=function($s,$n){return str_repeat($s,$n);}and$n=substr_count($s,'a'))?$f('e',$n).$f($o,$n).'w':$f('oo',substr_count($s,$o)));
=)