Longest prefix of a string.

Given a string containing symbols '<' and '>' I need to find the longest prefix string.e.g.
<<>> gives 4
>< gives 0
<>>> gives 2

Note: Every > must belong to only one <.
Topic archived. No new replies allowed.