At the intersection, there is a tram junction as shown in the figure. It is a single-level junction, meaning there are no overpasses or tunnels. Due to a temporary suspension of traffic, queues of trams have formed from all directions: , , and . For each tram, its destination is known: trams from side are heading either to or ; trams from side are going to either or ; and trams from side are traveling to either or . Each tram takes exactly one minute to cross the intersection, regardless of its origin or destination. Trams with non-intersecting paths can cross the intersection simultaneously.
Your task is to determine the minimum time (in minutes) required for all trams to clear the intersection according to their routes. The only requirement is to avoid collisions; traffic rules do not need to be followed.
The first line contains only the characters and/or , indicating the destinations of trams arriving from side . The first (leftmost) character corresponds to the first tram (closest to the intersection), the second character to the second tram, and so on. Similarly, the second line contains only the characters and/or , specifying the destinations of trams arriving from side . The third line contains only the characters and/or , indicating the destinations of trams arriving from side . Each line has a length between and .
Output a single number: the minimum number of minutes required for all trams to pass through the intersection.
Example 1