On Mon, Jul 08, 2002 at 10:54:15AM -0400, Ala Qumsieh wrote:
> s/^(.*) \1$/$1/mg;

By writing s/^(.*) \1$/$1/m|... I could get rid of the g (gaining one stroke)
by piggybacking on the while loop to remove all the duplicates. A slight
disadvantage is that the runtime is considerably longer -- the large test cases
take a few seconds to complete -- but it stays in the "reasonable" frame.

> $_&&&

This is good. I struggled for quite some time with a $_&&die statement at the
end (the funkiest way to write it that I found was ??&&die, but still it was
too long) when I thought of the divide-by-zero trick that many players used,
hence:

  1/!$_

which is exactly the same length (but I've seen a/!//, which i like better)
and dies when the input string is not-empty (hence !$_ is equal to zero) as
it tries to divide by zero. Otherwise, my solution is the same as Ala's.

pom

Reply via email to