RosettaCodeData/Task/Determine-if-a-string-is-squeezable/APL/determine-if-a-string-is-squeezable-2.apl
2023-07-01 13:44:08 -04:00

36 lines
864 B
APL

#!/usr/local/bin/apl --script
r c squeeze s
s 0,s,0
r 1¯2((sc)s),¨c
r display s
r (¯2s),' «««',s,'»»»'
r c show s
r ("chr: '",c,"'")
r r, (" in: ",display s)
r r, ("out: ",display c squeeze s)
r r
main
s1''
s2'"If I were two-faced, would I be wearing this one?"'
s2s2,' --- Abraham Lincoln '
s3'..1111111111111111111111111111111111111111111111111'
s3s3,'111111111111117777888'
s4'I never give ''em hell, I just tell the truth, and t'
s4s4,'hey think it''s hell. '
s5' '
s5s5,' --- Harry S Truman '
' ' show s1
'-' show s2
'7' show s3
'.' show s4
{ show s5}¨' -r'