2000. Reverse Prefix of Word Updated: 2024-03-12 1 min read Algorithms , LeetCode On This PageLeetCode problem 2000class Solution: def reversePrefix(self, word: str, ch: str) -> str: i = word.find(ch) return word if i == -1 else word[i::-1] + word[i + 1 :]