Implement strtok.
Asked in the Onsite stage. Completed in 25 minutes of the allotted 45 minutes, but interviewer expected a second question.
Write a function that behaves like strtok for a single input string: each call returns the next token from s, split by any character in delimiters, and returns None after the last token. Consecutive delimiters are treated as one separator, and leading or trailing delimiters do not produce empty tokens.
def strtok(s, delimiters):
s: a string to tokenizedelimiters: a string containing delimiter charactersNone when no tokens remaindef strtok(s, delimiters):