String Splitting
Submit solution
C++, Python3
Points:
1
Time limit:
1.0s
Memory limit:
64M
Author:
Problem type
Allowed languages
You are required to write lab3p2.cpp
and implement a function that splits
a string
object by +
, -
, and , without removing them.
Here's the function prototype:
void split(std::string src, std::string* ans);
This function will detect the characters +
, -
, and whitespaces, and store
the split segments into the ans
array.
For example, given src
equals:
"I like+cheese,-how about+you?"
the value of ans
should be:
["I", "like", "cheese,", "how", "about", "you?"]
After you are done, upload the content of your lab3p2.cpp
onto the OJ here.
Input Specification
No input specification. OJ will automatically judge your implementation of
lab3p2.cpp
.
Output Specification
No output specification. OJ will automatically judge your implementation of
lab3p2.cpp
.
Comments
Hint: here's the code for the main programme used in evaluation: