# List the Differences Between Two Strings

Aced (formerly Exponent) publishes a public search API over its indexed pages; the guide is at https://www.aced.io/agents/agent-access.

Source: https://www.aced.io/questions/3063/list-differences-two-strings
Source observed: 2026-11-05T00:29:21.217Z
Last checked: 2026-11-05T00:29:21.217+00:00
Indexed: 2026-11-07T00:47:21.694+00:00

---

# List the Differences Between Two Strings

**Difficulty:** Medium  
**Categories:** [Data Structures & Algorithms](https://www.aced.io/questions?type=algorithms), [Coding](https://www.aced.io/questions?type=coding)

We use this coding question to practice finding a minimum-edit sequence that transforms one uppercase-letter string into another.

## Problem

Given two strings of uppercase letters, `source` and `target`, return a sequence of edit tokens that converts `source` to `target` using the fewest edits possible.

For each character `C` in `source`, choose one of these actions:

- Write `C`. This keeps the character and does not count as an edit.
- Write `-C`. This removes the character and counts as one edit.

Between any tokens, you may write `+D`, where `D` is any letter. This inserts a character and counts as one edit.

When the tokens are read from left to right, excluding tokens prefixed with `-` and ignoring the plus signs, the resulting letters must spell `target`.

## Example

For:

```text
source = "ABCDEFG"
target = "ABDFFGH"
```

One valid minimum-edit answer is:

```text
["A", "B", "-C", "D", "-E", "F", "+F", "G", "+H"]
```

The sequence contains four edits: removing `C`, removing `E`, inserting `F`, and inserting `H`. After subtraction tokens are ignored, the remaining letters represent `A, B, D, F, +F, G, +H`, which produces `target`.

If multiple answers use the fewest edits, choose the answer that favors removing characters from `source` later.

## Practice interface

The available tabs are **Question**, **Solution**, and **Community**. The question also provides **Hint 1** through **Hint 4** and **Challenge 1**. The coding workspace includes **Editor**, **Share**, **Output**, **Test Results**, and **Console** views.

You can [sign up to run code](https://www.aced.io/signup?src=lesson). Detailed company statistics for this question are available through [Upgrade](https://www.aced.io/upgrade?src=questions).

## Related questions

- [What are the differences between RAM and ROM?](https://www.aced.io/questions/4617/ram-vs-rom)
- [What are the differences between TCP and UDP?](https://www.aced.io/questions/928/differences-between-tcp-and-udp)
- [What's the difference between IaaS, PaaS, SaaS?](https://www.aced.io/questions/7298/explain-iaas-paas-saas-differences)

There are currently no community-contributed answers shown for this question.

---

[Read this page’s summary](https://www.aced.io/agents/api/public/v1/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3063%2Flist-differences-two-strings&trace=t_679ff9ab98f3)

## Ask a follow-up about this page

Need a more specific answer? Ask the exact question you have. It returns a fresh, cited answer from Aced (formerly Exponent)’s knowledge base. No account or API key required.

Open this URL with your own question, URL-encoded. Include your question in q. All research inputs are optional; no account or setup.

`GET https://www.aced.io/agents/agent/faq?q={question}&trace=t_679ff9ab98f3`

[Tool guide and examples](https://www.aced.io/agents/agent-access) · [OpenAPI](https://www.aced.io/agents/api/public/v1/openapi.json) · [Page TLDR form](https://www.aced.io/agents/agent-tools/page-tldr?url=https%3A%2F%2Fwww.aced.io%2Fquestions%2F3063%2Flist-differences-two-strings). Opening a form does not execute a tool.