Lexicographic Maximum String Rotation
Bounded UTF-16 string lexicographic maximum string rotation; exact code-unit matching, no Unicode normalization or grapheme inference.
Description
Bounded UTF-16 string lexicographic maximum string rotation; exact code-unit matching, no Unicode normalization or grapheme inference.
A cyclic string may have several offsets producing the same maximum rotation. All maximizing offsets are useful evidence.
When to use this tool
Bounded UTF-16 string lexicographic maximum string rotation; exact code-unit matching, no Unicode normalization or grapheme inference.
- Prepare the supplied text fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter text. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.value, result.offsets. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Generate every left rotation, select the largest under ordinary UTF-16 lexicographic sorting and return its value plus all zero-based offsets producing it.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| text | text. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.value | The value value under the stated formula or text convention. |
| result.offsets | The offsets list in the ordering and representation described above. |
{
"input": {
"text": "baba"
},
"output": {
"result": {
"value": "baba",
"offsets": [
0,
2
]
}
}
} Limitations and assumptions
- This is not locale collation or numeric ordering. Empty input yields empty value with offset [0].
- The string-analysis source text is bounded to 128 UTF-16 code units; offsets and lengths use those code units.
- All declared input fields are required and unexpected top-level fields are rejected. Numbers must be finite; lists are limited to 128 entries and ordinary text fields to 8,192 UTF-16 code units, with tighter limits where stated.
- JSON text inputs must parse within bounded nesting and size limits. Numeric outputs outside the safe finite range are rejected; large exact integer results use decimal strings. Indexes and half-open spans are zero-based unless a rank is explicitly described as one-based.
Alternative or Complementary methods
Use a code-point or grapheme-aware text method when the task concerns user-perceived characters. These bounded literal operations retain case and code-unit structure rather than normalizing linguistic text.
References
Similar or alternative tools
- Lexicographic Minimum String Rotation
Bounded UTF-16 string lexicographic minimum string rotation; exact code-unit matching, no Unicode normalization or grapheme inference.
- String Cyclic Rotation Offsets
Return all cyclic left-rotation offsets mapping one UTF-16 string to another; all tied witnesses are retained, including periodic strings.