01 · Question
Without using a built-in string split method, implement a split(s, c) method, which receives a string s and a character c and splits s at each occurrence of c, returning a list of strings.
Examples:
- s = "split by space", c = ' '
- Output: ["split", "by", "space"]
- s = "beekeeper needed", c = 'e'
- Output: ["b", "", "k", "", "p", "r n", "", "d", "d"]
- s = "/home/../Documents/", c = '/'
- Output: ["", "home", "..", "Documents", ""]
- s = "", c = '?'
- Output: []