# 1405. Longest Happy String

<https://leetcode.com/problems/longest-happy-string>

## Description

A string is called *happy* if it does not have any of the strings `'aaa'`, `'bbb'` or `'ccc'` as a substring.

Given three integers `a`, `b` and `c`, return **any** string `s`, which satisfies following conditions:

* `s` is *happy*and longest possible.
* `s` contains **at most** `a` occurrences of the letter `'a'`, **at most** `b` occurrences of the letter `'b'` and **at most** `c` occurrences of the letter `'c'`.
* `s`will only contain `'a'`, `'b'` and `'c'` letters.

If there is no such string `s` return the empty string `""`.

**Example 1:**

```
**Input:** a = 1, b = 1, c = 7
**Output:** "ccaccbcc"
**Explanation:** "ccbccacc" would also be a correct answer.
```

**Example 2:**

```
**Input:** a = 2, b = 2, c = 1
**Output:** "aabbc"
```

**Example 3:**

```
**Input:** a = 7, b = 1, c = 0
**Output:** "aabaa"
**Explanation:** It's the only correct answer in this case.
```

**Constraints:**

* `0 <= a, b, c <= 100`
* `a + b + c > 0`

## 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/1405-longest-happy-string.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.
