Easy understandable sountion in java with o(N) complexity
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int longestBeautifulSubstring(String word) {\n        char[] arr = {\'a\', \'e\', \'i\', \'o\', \'u\'};\n        int index = 0;\n        int maxLength = 0;\n        int len = 0;\n        int s = 0;\n        int i = 0;\n\n        while (i < word.length()) {\n            if (arr[index] == word.charAt(i)) {\n                len++;\n                s = 1;\n                i++;\n            } else if (index != 4 && arr[index + 1] == word.charAt(i) && s == 1) {\n                len++;\n                index++;\n                i++;\n            } else {\n                if (index == 4) {\n                    maxLength = Math.max(maxLength, len);\n                }\n                s = 0;\n                index = 0;\n                len = 0;\n                if(word.charAt(i)!=\'a\'){\n                    i++;\n                }\n            }\n        }\n\n        if (index == 4) {\n            maxLength = Math.max(maxLength, len);\n        }\n\n        return maxLength;\n    }\n}\n\n```
['Java']