Single Insertion Witness
Return all insertion positions in the right string witnessing exactly one inserted UTF-16 unit from the left; repeated-unit ambiguities are retained.
Description
Return all insertion positions in the right string witnessing exactly one inserted UTF-16 unit from the left; repeated-unit ambiguities are retained.
An insertion can have several equivalent witness positions when repeated characters are present.
When to use this tool
Return all insertion positions in the right string witnessing exactly one inserted UTF-16 unit from the left; repeated-unit ambiguities are retained.
- Prepare the supplied left, right 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 left, right. 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.indexes. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require each string at most 128 UTF-16 code units. If right is one unit longer, remove each right-side unit in turn and return all indexes whose deletion yields left; otherwise return an empty list.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| left | left. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
| right | right. | 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.indexes | The indexes list in the ordering and representation described above. |
{
"input": {
"left": "ab",
"right": "aab"
},
"output": {
"result": {
"indexes": [
0,
1
]
}
}
} Limitations and assumptions
- Witness indexes refer to right. The operation is directional and works on code units, without normalization or grapheme awareness.
- 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
- Single Substitution Witness
Witness exactly one changed UTF-16 unit between equal-length strings; zero or multiple changes yield null, not a fuzzy distance.
- Adjacent Transposition Witness
Find exact one-adjacent-transposition witnesses between bounded UTF-16 strings; swapping equal adjacent units is excluded as no change.