String processing II: tokenizing with state
- Stage
- 3
- Module
- M3.4
- Lessons
- 1
In this module
- Parse a string into tokens based on separators or delimiters.
- Track state while building tokens to handle multi-character delimiters or contextual rules.
- Build a list of tokens by appending complete tokens when a delimiter is found.
Before this module
Lessons
Practice
Try these on the judges. Each link opens the problem on WMOJ or DMOJ.
- 2019 J3Cold Compress (opens on DMOJ in a new tab) DMOJ
Decompress a run-length encoded string one token at a time.
Why DMOJ: A state-tracking tokenizing problem from the same era as this lesson's examples.
- 2023 J3Special Event (opens on WMOJ in a new tab) WMOJ
Read a line of tokens and track the maximum, joining names on a tie.
- 2025 J3Product Codes (opens on WMOJ in a new tab) WMOJ
Tokenize a line into distinct character classes, including signed multi-digit numbers.