Line Gimmick

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 MB

Problem

You are standing in front of the line gimmick of a game. The gimmick is a row of NN 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.

  • Move right, and the 2nd panel disappears.
  • Move left, and the 3rd panel disappears.
  • Move right, and the 1st panel disappears.
  • Move right, and the 4th panel disappears.
  • Move left, and the 5th panel disappears.
  • Leave the gimmick.

You are given a gimmick with NN panels. Compute the largest number of panels that can disappear before you leave the gimmick.

Input

The first line contains the number of panels NN (1N1000001 \le N \le 100000).

The second line contains a string SS of length NN made up of the characters > and < only. The ii-th character of SS is the arrow direction of the ii-th panel from the left, where < means left and > means right.

Output

Print the largest number of panels that can disappear before you leave the gimmick.