diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-05-04 21:14:59 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-04 21:14:59 +0100 |
| commit | 4f6bea99af9e40ddc033f3fc34f762266731c827 (patch) | |
| tree | 4311bce3734c03c43fdb9694dce6ed230a626b1a /challenge-111/abigail/lua/ch-2.lua | |
| parent | a636015eef980dbc91fa8216f0cfb942ceaad11a (diff) | |
| parent | 74e93b7c85b2797a877de91fe9e6eb3ad59c9650 (diff) | |
| download | perlweeklychallenge-club-4f6bea99af9e40ddc033f3fc34f762266731c827.tar.gz perlweeklychallenge-club-4f6bea99af9e40ddc033f3fc34f762266731c827.tar.bz2 perlweeklychallenge-club-4f6bea99af9e40ddc033f3fc34f762266731c827.zip | |
Merge pull request #4017 from Abigail/abigail/week-111
Abigail/week 111
Diffstat (limited to 'challenge-111/abigail/lua/ch-2.lua')
| -rw-r--r-- | challenge-111/abigail/lua/ch-2.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-111/abigail/lua/ch-2.lua b/challenge-111/abigail/lua/ch-2.lua new file mode 100644 index 0000000000..6beeb6a979 --- /dev/null +++ b/challenge-111/abigail/lua/ch-2.lua @@ -0,0 +1,25 @@ +#!/opt/local/bin/lua + +-- +-- See ../README.md +-- + +-- +-- Run as: lua ch-2.lua < input-file +-- + +local longest = "" + +for line in io . lines () do + -- + -- Find words with their letters in lexical order, and which are + -- longer than the longest found so far. + -- + if line : lower () + : find ("^a*b*c*d*e*f*g*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*$") + and line : len () > longest : len () + then longest = line + end +end + +print (longest) |
