Determine if a string is collapsible: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
(Frink) |
||
Line 1,445: | Line 1,445: | ||
</pre> |
</pre> |
||
=={{header|Frink}}== |
|||
<lang frink>collapse[str] := str =~ %s/(.)\1+/$1/g |
|||
lines = ["", |
|||
""""If I were two-faced, would I be wearing this one?" --- Abraham Lincoln """, |
|||
"..1111111111111111111111111111111111111111111111111111111111111117777888", |
|||
"I never give 'em hell, I just tell the truth, and they think it's hell. ", |
|||
" --- Harry S Truman "] |
|||
for line = lines |
|||
println[collapse[line]]</lang> |
|||
{{out}} |
|||
<pre> |
|||
"If I were two-faced, would I be wearing this one?" - Abraham Lincoln |
|||
.178 |
|||
I never give 'em hel, I just tel the truth, and they think it's hel. |
|||
- Hary S Truman |
|||
</pre> |
|||
=={{header|Go}}== |
=={{header|Go}}== |