Created
January 1, 2015 04:47
-
-
Save anonymous/efdb2ac517daeda7ad5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
decode3[string_] := Module[{spliced, zeroed, levels, sorted, strings}, | |
spliced = | |
StringReplace[ | |
str, {"[" | "{" | "(" -> -1, "]" | "}" | ")" -> 1, " " -> 0}]; | |
zeroed = spliced /. _String :> 0; | |
levels = Accumulate[zeroed]; | |
sorted = spliced[[Ordering@levels]]; | |
strings = Cases[sorted, _String]] | |
decode3["[can {and it(it (mix) up)} look silly]"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment