Determine if a string is collapsible: Difference between revisions
Content added Content deleted
Line 149: | Line 149: | ||
" --- Harry S Truman "] |
" --- Harry S Truman "] |
||
collapse(s) = (t = isempty(s) ? "" : s[1]; for c in s if c != t[end] t *= c end; end; t) |
collapse(s) = (t = isempty(s) ? "" : s[1:1]; for c in s if c != t[end] t *= c end; end; t) |
||
for s in teststrings |
for s in teststrings |