← 返回 bloomberg 的题目列表Find occurrence and constraint
类型:online_judge
Given a string and a character, find all occurrences of this character in the string. Then, add a constraint: if the next character in the position is the specified character 'X', then ignore this position in the result. Implement a function that fulfills the requirements and provide the time complexity. Error handling is not required.
Example:
Input: String: "abcXadXbeXcde" Character: "d"
Output: Positions: [3, 7]
Constraints:
String length does not exceed 1000.
Ensure the uniqueness of the results.
Tags: String manipulation
Example
Input
abcXadXbeXcde
d