aboutsummaryrefslogtreecommitdiff
path: root/challenge-253/luca-ferrari/python/ch-1.py
blob: 07a97f09cdac39d755bdf953657441bef2c8740e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!python

#
# Perl Weekly Challenge 253
# Task 1
#
# See <https://perlweeklychallenge.org/blog/perl-weekly-challenge-253>
#

import sys
import re

# task implementation
# the return value will be printed
def task_1( args ):
    separator   = args[ 0 ];
    split_words = []
    for i in range( 1, len( args ) ):
        current_words = args[ i ]
        for w in re.split( "[%s]" % separator, current_words ):
            split_words.append( w )

    return ','.join( split_words )


# invoke the main without the command itself
if __name__ == '__main__':
    print( task_1( sys.argv[ 1: ] ) )