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: []
a
0
1
b
2
3
c
4
s = "a b c"
s=a b c
c=
res=[]
current=
Step 1 / 7
Step 1:
Initialize result list and current buffer
Focus: default
s="a b c"c=" "current=""