Given a row of panels with arrows, pick a starting panel and count how many panels can disappear if the walk is chosen to maximize that count.
Medium6GreedyImplementationSimulationMathNo attempts yetTime limit5sMemory limit512 MBYou are standing in front of the line gimmick of a game. The gimmick is a row of N panels, and each panel displays either a right arrow or a left arrow.
You can step onto the gimmick from any panel. Once you step onto a panel, you are forced to move in the direction of the arrow on that panel, and the panel disappears at once. You keep moving in the same direction until you reach another panel. When you reach a panel, you turn to the direction of its arrow, and you keep going straight if that arrow points the way you are already moving. Every panel you pass disappears as well. You repeat this, and when no panel is left in the direction you are moving, you leave the gimmick.
For example, take a gimmick whose arrows read >, >, <, >, < from the left. If you first step onto the 2nd panel from the left, you move like this.

You are given a gimmick with N panels. Compute the largest number of panels that can disappear before you leave the gimmick.
The first line contains the number of panels N (1≤N≤100000).
The second line contains a string S of length N made up of the characters > and < only. The i-th character of S is the arrow direction of the i-th panel from the left, where < means left and > means right.
Print the largest number of panels that can disappear before you leave the gimmick.