diff options
| author | HVukman <peterslopp@googlemail.com> | 2025-07-05 15:58:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-05 15:58:30 +0200 |
| commit | d01d8eef0858daf23559c629a6e674e31bd39196 (patch) | |
| tree | cd46babde4fccd032224b4e011fd0f643b87a484 /challenge-328 | |
| parent | 2a080aaf4034902d5b9acd0762a8f2a4bb80a8a2 (diff) | |
| download | perlweeklychallenge-club-d01d8eef0858daf23559c629a6e674e31bd39196.tar.gz perlweeklychallenge-club-d01d8eef0858daf23559c629a6e674e31bd39196.tar.bz2 perlweeklychallenge-club-d01d8eef0858daf23559c629a6e674e31bd39196.zip | |
Create 328_p2.lua
Diffstat (limited to 'challenge-328')
| -rw-r--r-- | challenge-328/hvukman/lua/328_p2.lua | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/challenge-328/hvukman/lua/328_p2.lua b/challenge-328/hvukman/lua/328_p2.lua new file mode 100644 index 0000000000..b536078589 --- /dev/null +++ b/challenge-328/hvukman/lua/328_p2.lua @@ -0,0 +1,55 @@ + +function Bad (a) +local new_str = "" +local need = false +for i = 1, string.len(a)-1 do + local char = string.sub(a, i, i) + local char_next = string.sub(a, i+1, i+1) + + if string.match(char, "%u") and string.match(char_next, "%l") then + if char == string.lower(char_next) then + + local new = {} + for j = 0,string.len(a) do + if j ~= i and j~= i+1 then + + table.insert(new,string.sub(a, j, j)) + end + end + new_str = table.concat(new) + -- print ("maybe not here ", new_str) + need= true + break + end + + elseif string.match(char, "%l") and string.match(char_next, "%u") then + if string.upper(char) == char_next then + local new = {} + for j = 0,string.len(a) do + if j ~= i and j~= i+1 then + + table.insert(new,string.sub(a, j, j)) + end + end + new_str = (table.concat(new)) + --print ("maybe not ", new_str) + need=true + break + + end + end + + +end + -- print ("new " , new_str) + if need then + Bad(new_str) + else + print(a) + end +end + + +Bad("WeEeekly") +Bad("abc") +Bad("abBAdD") |
