A little better
#!perl -056pa
@v=map{$V+=$v=y/aeiouyAEIOUY//."/".(@n=/\w/g);$N+=@n;$v.$"x(length($_.=$"x(3-length))-length$v)}@F;$_="@F";s/ *$//;s/(.{57})....+/$1.../;$#v=s/\w+/$&/g-1;$_=/\./&&@F.": $_
$V/$N: @v
";$V=$N=!s/\s+$/
/
|
Too little, too late...
#!perl -056pa
@v=map{$V+=$v=y/aeiouyAEIOUY//."/".(@n=/\w/g);$N+=@n;$v.$"x(length($_.=$"x(3-length))-length$v)}@F;$_="@F";s/ *$//;s/(.{57})....+/$1.../;$#v=s/\w\S+/$&/g-1;$_=/\./&&@F.": $_
$V/$N: @v
";$V=$N=!s/\s+$/
/
|
Passed `/anick! Yippee!
#!perl -056pa
@v=map{$V+=$v=y/aeiouyAEIOUY//."/".(@n=/\w/g);$N+=@n;$v.$"x(length($_.=$"x(3-length))-length$v)}@F;$_="@F";s/ *$//;s/(.{57})....+/$1.../&&($#v=@x=/\w\S+/g)--;$_=/\./&&@F.": $_
$V/$N: @v
";$V=$N=!s/\s+$/
/
|
Minor improvement
#!perl -056na
@v=map{$V+=$v=y/aeiouyAEIOUY//."/".(@n=/\w/g);$N+=@n;$v.$"x(length($_.=$"x(3-length))-length$v)}@F;$_="@F";s/ *$//;s/(.{57})....+/$1.../&&($#v=@x=/\w\S+/g)--;$_=@F.": $_
$V/$N: @v";s/ *$/
/;$V=$N=!print if/\./
|
Ahh, remembered to remove the \t's this time... :-)
#!perl -056na
@v=map{$V+=$v=y/aeiouyAEIOUY//."/".(@n=/\w/g);$N+=@n;$v.$"x(length($_.=$"x(3-length))-length$v)}@F;$_="@F";s/ *$//;s/(.{57})....+/$1.../&&($#v=s/\w\S+/$&/g-1);$_=@F.": $_
$V/$N: @v";s/ *$/
/;$V=$N=!print if/\./
|
This passes tpr04.pl but fails on the sample text: "I am just a poor sample paragraph. Please don't treat me too hard as you split and separate me into vowels and stuff." because of the /\w+/g only works on continuous series of letters and fails on "don't"
#!perl -056na
$_.=$"x(3-length)for@F;$_="@F";@v=map{$V+=$v=y/aeiouyAEIOUY//."/".(@n=/\w/g);$N+=@n;$v.$"x(length()-length$v)}@F;s/ *$//;s/(.{57})....+/$1.../&&splice@v,(@x=/\w+/g);$_=@F.":\t$_
$V/$N:\t@v";s/ *$/
/;$V=$N=!print if/\./
|
This slightly longer solution passes the test that my previous solution failed I think it is a good solution and not just another hack, but I'm not 100% sure
#!perl -056na
$_.=$"x(3-length)for@F;$_="@F";@v=map{$V+=$v=y/aeiouyAEIOUY//."/".(@n=/\w/g);$N+=@n;$v.$"x(length()-length$v)}@F;s/ *$//;s/(.{57})....+/$1.../&&splice@v,(@x=/\w\S+/g);$_=@F.":\t$_
$V/$N:\t@v";s/ *$/
/;$V=$N=!print if/\./
|
Minor improvement
#!perl -056na
$s=$w=$N=$V=!print+(map{$N+=@n=/\w/g;$V+=$z=y/aeiouyAEIOUY//."/".@n;$w.=$".$"x($d=length($s)-length$w),$s.=$".$"x-$d if$w;$s.=$z;($w.=$_)=~s/(.{57})....+/$1.../&&$s=~s/(.{56}\S*).*/$1/;$s=~s/ *$//}@F).": $w
$V/$N: $s
"if/\./
|
Ugh. Way too much work for such a long solution... This problem is hard.
#!perl -056n
$s=$w=$N=$V=!print+(map{$N+=@n=/\w/g;$V+=$z=y/aeiouyAEIOUY//."/".@n;$w.=$".$"x($d=length($s)-length$w),$s.=$".$"x-$d if$w;$s.=$z;($w.=$_)=~s/(.{57})....+/$1.../&&$s=~s/(.{56}\S*).*/$1/;$s=~s/ *$//}split).": $w
$V/$N: $s
"if/\./
|
I hope the literal tabs come through OK...
#!perl -ln
map{$N+=@n=/\w/g;$V+=$z=y/aeiouyAEIOUY//."/".@n;$w.=$".$"x($d=length($s)-length$w),$s.=$".$"x-$d if$W++;$s.=$z;($w.=$_)=~s/(.{57})....+/$1.../&&$s=~s/(.{56}\S*).*/$1/;$s=~s/ *$//;$s=$w=$W=$V=$N=!print"$W: $w
$V/$N: $s"if/\./}split
|
Phew! It took a while to just get a WORKING solution, let alone an optimized one.
#!perl -ln
map{$t=lc;$V+=$v=$t=~y/aeiouy//;$N+=$n=$t=~s/\w//g;$W++;if($L-$l+$i<61){$i=length;$
l=3>$i?4:$i+1;$f="%-${l}s";$w.=sprintf$f,$_;$s.=sprintf$f,"$v/$n";if(60<$L+$i){subs
tr($w,57)="...";$s=~s/(.{56}\S*) .*/$1/;}$L+=$l;}if(/\./){$w=~s/\s+$//;$s=~s/\s+$//;print"$W:\t$w";print"$V/$N:\t$s";$s=$w=$L=$W=$V=$N="";}}split
|