RosettaCodeData/Task/Semordnilap/TAV/semordnilap.tav
2025-08-11 18:05:26 -07:00

22 lines
610 B
Text

main(params):+
seen =: new map
inwrds =: 0
pairs =: 0
palindromes =: 0
?# line =: file 'unixdict.txt' give lines
inwrds =+ 1
wrd =: string line case to lower
rwrd =: string wrd from -1 length wrd.Count step -1
? wrd = rwrd
palindromes =+ 1
?^
? seen{rwrd} = ()
seen{wrd} =: line \ not yet seen, remember
|
pairs =+ 1
? pairs < 7
print wrd __ rwrd
print pairs, "pairs, " nonl
print palindromes, "palindromes, " nonl
print inwrds, "input words."