List every vowel-only substring of a string in order of appearance
Company: Splunk
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Other
Given a string `s`, return all substrings of `s` that contain only vowels (`a`, `e`, `i`, `o`, `u`).
The substrings should be returned in the order they appear in the string. Include duplicate substrings if they appear at different positions.
### Function Signature
```python
def vowel_only_substrings(s: str) -> list[str]:
```
### Rules
- The vowels are the five letters `a`, `e`, `i`, `o` and `u`. Every other letter, including `y`, is a consonant.
- A substring is a non-empty run of consecutive characters `s[start:end]`. Each `(start, end)` pair whose characters are all vowels appears in the output exactly once, so equal strings taken from different positions all appear.
- Order the output by start index ascending, and for the same start index by length ascending.
- If `s` contains no vowel, return an empty list.
### Constraints
- `1 <= len(s) <= 1000`
- `s` consists of lowercase English letters.
### Examples
```text
Input: s = "abcde"
Output: ["a","e"]
```
The only vowels are `"a"` at index 0 and `"e"` at index 4. The consonants `b`, `c` and `d` sit between them, so no longer substring is vowel-only.
```text
Input: s = "aeiou"
Output: ["a","ae","aei","aeio","aeiou","e","ei","eio","eiou","i","io","iou","o","ou","u"]
```
The whole string is vowels, so all 15 of its substrings are valid. They are listed by start index, and by length within each start.
```text
Input: s = "ouyoo"
Output: ["o","ou","u","o","oo","o"]
```
The `y` splits the string into the vowel runs `"ou"` (indices 0 to 1) and `"oo"` (indices 3 to 4). The run `"oo"` gives `"o"` from index 3, `"oo"`, and `"o"` again from index 4, and every repeated `"o"` is kept.
Overview: Given a lowercase string, list every substring made only of the vowels a, e, i, o and u, keeping repeats from different positions and ordering them by start index and then by length. It tests string scanning, splitting a string into runs, and complexity analysis when the output itself is large.