Transform Set of Strings to Common Prefix Notation
README.md | ||
trie.py |
Transform Set of Strings to Common Prefix Notation
Description
Presented with a series of lines on standard input, the program will print an expression on standard output that denotes the line strings in a syntax described in https://tk-sls.de/wp/6071.
The expression is suitable for Bourne Again Shell brace expansion.
Test
$ python3 trie.py << EOF
a
ab
abc
EOF
Expected output:
a{,b{,c}}
Test if the output is accurate:
$ bash -c 'echo a{,b{,c}}'
Expected output:
a ab abc