Hack Frontend Community

Join Strings with Separator

Sber
You need to write a function strjoin(separator, ...strings) that joins strings with a given separator. The function should take a separator string as the first argument, and the remaining arguments are strings to be joined. If there are no strings, the function should return an empty string.

Examples:

Input 1: ' ', 'Hello', 'World'
Output 1: 'Hello World'
Input 2: '-', 'a', 'b', 'c', 'd'
Output 2: 'a-b-c-d'
Input 3: ':', 'one', 'two'
Output 3: 'one:two'
Input 4: '/', '2023', '01', '01'
Output 4: '2023/01/01'
Run your code to see results.