Solved LeetCode program · 959 of 1,000
#1328 · Break a Palindrome
Original English source
Keep a shared word as empty text. Keep a shared seeds as an empty list of text. Keep a shared mark as empty text. Keep a shared lowercode of 0. Place "abccba" into seeds. Set word to item 0 of seeds. Set lowercode to character 0 of "a". Place character 0 of "a" into mark.
To replace at spot (a whole number). The head is the slice of word from 0 to spot. The tail is the slice of word from spot plus 1 to 6. The parts is a list of head, mark, and tail. The result is join parts with empty text. Show result.
The spot is 0. The changed is 0.
Repeat while spot is less than 3 and changed is 0.
The piece is character spot of word. The here is spot. Add 1 to spot. If piece is not lowercode, Replace at here, set changed to 1.
Expected stdout
aaccba