Accordion
Consider a sequence of characters made up of '[', ']', ':', and '|'. A valid sequence, which we will call a "bayan," starts with the character '[', followed by X occurrences of ':', then Y occurrences of '|', followed again by X occurrences of ':', and ends with the character ']' (X > 0, Y > 0).
Given a string A composed of the characters '[', ']', ':', and '|', your task is to identify the longest substring of A that forms a bayan.
A substring is defined as a sequence of consecutive characters within the string.
Input
The input consists of a single non-empty string A, which includes the characters '[', ']', ':', and '|', and has a maximum length of 100.
Output
Output the longest substring of A that qualifies as a bayan. If no such substring exists, output "][". In the case of multiple substrings of the same maximum length, choose the one containing the most '|' characters.