CF725A.Jumping Ball

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of nn bumpers. The bumpers are numbered with integers from 11 to nn from left to right. There are two types of bumpers. They are denoted by the characters '<' and '>'. When the ball hits the bumper at position ii it goes one position to the right (to the position i+1i+1 ) if the type of this bumper is '>', or one position to the left (to i1i-1 ) if the type of the bumper at position ii is '<'. If there is no such position, in other words if i-1<1 or i+1>n , the ball falls from the game field.

Depending on the ball's starting position, the ball may eventually fall from the game field or it may stay there forever. You are given a string representing the bumpers' types. Calculate the number of positions such that the ball will eventually fall from the game field if it starts at that position.

输入格式

The first line of the input contains a single integer nn ( 1<=n<=2000001<=n<=200000 ) — the length of the sequence of bumpers. The second line contains the string, which consists of the characters '<' and '>'. The character at the ii -th position of this string corresponds to the type of the ii -th bumper.

输出格式

Print one integer — the number of positions in the sequence such that the ball will eventually fall from the game field if it starts at that position.

输入输出样例

  • 输入#1

    4
    <<><
    

    输出#1

    2
  • 输入#2

    5
    >>>>>

    输出#2

    5
  • 输入#3

    4
    >><<
    

    输出#3

    0

说明/提示

In the first sample, the ball will fall from the field if starts at position 11 or position 22 .

In the second sample, any starting position will result in the ball falling from the field.

首页