# 1542. Find Longest Awesome Substring

<https://leetcode.com/problems/find-longest-awesome-substring>

## Description

Given a string `s`. An *awesome* substring is a non-empty substring of `s` such that we can make any number of swaps in order to make it palindrome.

Return the length of the maximum length **awesome substring** of `s`.

**Example 1:**

```
**Input:** s = "3242415"
**Output:** 5
**Explanation:** "24241" is the longest awesome substring, we can form the palindrome "24142" with some swaps.
```

**Example 2:**

```
**Input:** s = "12345678"
**Output:** 1
```

**Example 3:**

```
**Input:** s = "213123"
**Output:** 6
**Explanation:** "213123" is the longest awesome substring, we can form the palindrome "231132" with some swaps.
```

**Example 4:**

```
**Input:** s = "00"
**Output:** 2
```

**Constraints:**

* `1 <= s.length <= 10^5`
* `s` consists only of digits.

## ac

```java
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jaywin.gitbook.io/leetcode/solutions/1542-find-longest-awesome-substring.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
