Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopstrings · suffix-deletion
The organizer’s problem statement is available at the official source link.
sample trace
Censoring: remove matching suffixes
Build the result from left to right. Whenever its newest suffix equals the censored word, remove that suffix immediately.
input
whatthemomooofunpattern
moostack Result
whatthefunevents
append characters left to rightsuffix moo appears; remove itcontinue with remaining characters
edges
- from
- input
- to
- stackResult
- label
- append / remove matching suffix
- 1
Append
Read the input one character at a time into the output stack. - 2
Check the suffix
After each append, test whether the stack now ends in the pattern moo. - 3
Delete and continue
Remove the matching suffix; the sample finishes as whatthefun.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 charsRun output
Run your code to see output.