[Java/Python 3] Sliding window codes, w/ brief explanation and analysis.
Loop through input string and maintain a sliding window to fit in beautiful substrings;\n2. Use a Set seen to check the number of distinct vowels in the sliding
1. Loop through input string and maintain a sliding window to fit in beautiful substrings;\n2. Use a Set `seen` to check the number of distinct vowels in the sliding window;\n3. Whenever adjacent letters is not in alpahbetic order, start a new window and new Set;\n4. For each iteration of the loop, add the correponding char and check the size of the Set `seen`; If the size reaches `5`, update the longest length;\n5. Return the longest length after the termination of the loop.\n\n```java\n    public int longestBeautifulSubstring(String word) {\n        int longest = 0;\n        Set<Character> seen = new HashSet<>();\n        for (int lo = -1, hi = 0; hi < word.length(); ++hi) {\n            if (hi > 0 && word.charAt(hi - 1) > word.charAt(hi)) {\n                seen = new HashSet<>();\n                lo = hi - 1;\n            }\n            seen.add(word.charAt(hi));\n            if (seen.size() == 5) {\n                longest = Math.max(longest, hi - lo);\n            }\n        }\n        return longest;\n    }\n```\nCredit to **@MtDeity**, who improve the following Python 3 code. \n```python\n    def longestBeautifulSubstring(self, word: str) -> int:\n        seen = set()\n        lo, longest = -1, 0\n        for hi, c in enumerate(word):\n            if hi > 0 and c < word[hi - 1]:\n                seen = set()\n                lo = hi - 1    \n            seen.add(c)    \n            if len(seen) == 5:\n                longest = max(longest, hi - lo)\n        return longest\n```\n\n**Analysis:**\n\nThere are at most `5` characters in Set `seen`, which cost space `O(1)`. Therefore, \nTime: `O(n)`, space: `O(1)`
[]