/* Longest word with unique characters in Picat. What is the longest word with unique (all distinct) characters? Here are the (accumulative) longest English words (from a certain wordlist): a ab abc abcs abdel abderus abditory abdomens abducens abducent abducing abducting abduction abductions abductores abjections abjunctive abolishment abridgments abruptiones absorptively adjunctively adsorptively ambidextrous ambidextrously benzhydroxamic dermatoglyphic dermatoglyphics maxLen = 15 dermatoglyphics was the only 15 chars word from that wordlist. * In Swedish there are a couple of longest words (15 chars): bordhyvelmaskin flugviktsboxare fästingplockare giftermålsanbud grophyvelmaskin hydropneumatisk hyvelmaskinbord ishockeyförbund jämlikhetsfråga kulörbeständiga oförvansklighet vulkanfibergods ögonblicksvärde This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ main => go. go => Words = read_file_lines("words_lower.txt"), MaxLen = 0, Max = [], foreach(W in Words) Len = W.len, if Len >= MaxLen then S = W.sort(), if S == S.remove_dups() then println(W), if Len == MaxLen then Max := Max ++ [W] else MaxLen := Len, Max := [W] end end end end, println(maxLen=MaxLen), println(Max), nl.