#C92. Split Nth Element

    ID: 53266 Type: Default 1000ms 256MiB

Split Nth Element

Split Nth Element

You are given a string S, a delimiter, and an integer n. Your task is to split the string S by the given delimiter into substrings and output the nth element (0-indexed) of the resulting list. If the nth element does not exist, print "Index out of range".

Note: The delimiter may consist of one or more characters, and the string S can contain spaces and other symbols. Ensure that your program handles these cases correctly.

inputFormat

The input is read from standard input (stdin) and consists of three lines:

1. The first line contains the string S.
2. The second line contains the delimiter.
3. The third line contains an integer n (0-indexed) representing the position of the element to output.

outputFormat

Output to standard output (stdout) the nth element after splitting the string S using the given delimiter. If there is no nth element, output "Index out of range".## sample

hello,world,this,is,python
,
3
is