aboutsummaryrefslogtreecommitdiff
path: root/challenge-253/sgreen/python/ch-1.py
blob: 661c767134390437659e2506b5ec1902219b09f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python3

import sys


def split_strings(words, sep):
    # Join the words together by the separator
    combined = sep.join(words)

    # Split them by the separator excluding empty strings
    return [ w for w in combined.split(sep) if w != '']

def main(inputs):
    # The separator is the last character
    sep = inputs.pop()
    result = split_strings(inputs, sep)
    print('"' + '", "'.join(result) + '"')

if __name__ == '__main__':
    main(sys.argv[1:])