31 lines
1.1 KiB
Text
31 lines
1.1 KiB
Text
function pangram(string s)
|
|
sequence az = repeat(false,26)
|
|
integer count = 0
|
|
for i=1 to length(s) do
|
|
integer ch = lower(s[i])
|
|
if ch>='a'
|
|
and ch<='z'
|
|
and not az[ch-96] then
|
|
count += 1
|
|
if count=26 then return {true,0} end if
|
|
az[ch-96] = true
|
|
end if
|
|
end for
|
|
return {false,find(false,az)+96}
|
|
end function
|
|
|
|
sequence checks = {"The quick brown fox jumped over the lazy dog",
|
|
"The quick brown fox jumps over the lazy dog",
|
|
".!$\"AbCdEfghijklmnoprqstuvwxyz",
|
|
"THE FIVE BOXING WIZARDS DUMP QUICKLY.",
|
|
"THE FIVE BOXING WIZARDS JUMP QUICKLY.",
|
|
"HEAVY BOXES PERFORM WALTZES AND JIGS.",
|
|
"PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS.",
|
|
"Big fjiords vex quick waltz nymph",
|
|
"The quick onyx goblin jumps over the lazy dwarf.",
|
|
"no"}
|
|
for i=1 to length(checks) do
|
|
string ci = checks[i]
|
|
integer {r,ch} = pangram(ci)
|
|
printf(1,"%-50s - %s\n",{ci,iff(r?"yes":"no "&ch)})
|
|
end for
|