All problems
Hashtag Splitting
Problem
Split a hashtag into words at uppercase boundaries. Remove a leading '#' and start a new part whenever an uppercase character follows a lowercase character, which keeps acronym runs together.
Return the list of parts, or an empty list when no text remains.
Hint
Only break when the previous character is lowercase, so acronyms stay glued together.
Test cases
case 1
in: ["#MachineLearning"]
expected: ["Machine","Learning"]
case 2
in: ["#NLP"]
expected: ["NLP"]
case 3
in: ["#deeplearning"]
expected: ["deeplearning"]
case 4
in: ["#MachineNLP"]
expected: ["Machine","NLP"]
case 5
in: [""]
expected: []
Starter codePython
def hashtag_split(tag):
# Your code here
pass5 test cases · run your code against them in the editor