Palindrome Single Substitution Positions

Bounded UTF-16 string palindrome single substitution positions; exact code-unit matching, no Unicode normalization or grapheme inference.

Description

Bounded UTF-16 string palindrome single substitution positions; exact code-unit matching, no Unicode normalization or grapheme inference.

Making a palindrome with exactly one character substitution differs from merely allowing at most one edit.

When to use this tool

Bounded UTF-16 string palindrome single substitution positions; 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

  1. Enter text. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.possible, result.positions. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Inspect mirrored code-unit pairs. For exactly one mismatched pair, return its two positions; for an already palindromic odd-length string, return its center. Otherwise positions is empty and possible false.1

Input fieldMeaning and representationAccepted input
texttext.Text; at most 8,192 UTF-16 code units, subject to the grammar above
Output fieldInterpretation
resultObject containing the named outputs below.
result.possibleFlag for possible under the exact condition described above.
result.positionsThe positions list in the ordering and representation described above.
json
{
  "input": {
    "text": "abca"
  },
  "output": {
    "result": {
      "possible": true,
      "positions": [
        1,
        2
      ]
    }
  }
}

Limitations and assumptions

  • The center can change without breaking an odd palindrome. An already palindromic even-length string is not accepted for exactly one actual substitution; no replacement characters are generated.
  • 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

  1. Tool behavior and example: Palindrome Single Substitution Positions — tool.io

Similar or alternative tools

  • Palindrome Single Deletion Indexes

    Bounded UTF-16 string palindrome single deletion indexes; exact code-unit matching, no Unicode normalization or grapheme inference.

  • Single Substitution Witness

    Witness exactly one changed UTF-16 unit between equal-length strings; zero or multiple changes yield null, not a fuzzy distance.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies