A. Jumping Ball

time limit per test

2 seconds
memory limit per test

256 megabytes

input

standard input

output

standard output

In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. The bumpers are numbered with integers from 1 to n 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 i it goes one position to the right (to the position i + 1) if the type of this bumper is '>', or one position to the left (to i - 1) if the type of the bumper at position i 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.

Input

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

Output

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.

Examples

input

4
<<><

output

2

input

5
>>>>>

output

5

input

4
>><<

output

0

Note

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

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

从左端数'<'个数与从右端数‘>’个数即可

 //2016.11.01
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; const int N = ;
char arr[N]; int main()
{
int n, ans;
while(scanf("%d", &n)!=EOF)
{
scanf("%s", arr);
ans = ;
for(int i = ; i < n; i++)
{
if(arr[i] == '>')break;
ans++;
}
for(int i = n-; i >= ; i--)
{
if(arr[i] == '<')break;
ans++;
}
printf("%d\n", ans);
} return ;
}

CodeForces 725A的更多相关文章

  1. CodeForces Canada Cup 2016【A,B,C,D】

    CodeForces 725A: 思路就是如果"最左"不是'>'这个了,那么这个右边的一定不可能到达左边了: 同理最右: CodeForces 725B: 有两个空姐,一个从 ...

  2. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  3. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  4. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  5. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  6. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  7. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

  8. CodeForces - 261B Maxim and Restaurant

    http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a ...

  9. CodeForces - 696B Puzzles

    http://codeforces.com/problemset/problem/696/B 题目大意: 这是一颗有n个点的树,你从根开始游走,每当你第一次到达一个点时,把这个点的权记为(你已经到过不 ...

随机推荐

  1. Trim(',')的作用去除最有一个','

    public bool XMLDataImport()        { List<string> sqllist = new List<string>();          ...

  2. python+django+bootstrap

    python install django 置环境变量,将这个目录添加到系统环境变量中: C:\Python36\Lib\site-packages\django\ cmd下测试: 1.输入pytho ...

  3. CentOS 6.4 X64 利用 yum 升级到 Oracle linux 6.4 内核

    cd /etc/yum.repos.d wget http://public-yum.oracle.com/public-yum-ol6.repo mv CentOS-Base.repo CentOS ...

  4. HTML学习(六)图像

    图像标签(<img>)和源属性(Src)在 HTML 中,图像由 <img> 标签定义.<img> 是空标签,意思是说,它只包含属性,并且没有闭合标签.要在页面上显 ...

  5. Codeforces#355

    大小号刷题,大号,被查重,悲剧,最后小号过了3题 A题: 分析:大于h的+2,小于等于h的+1 #include <iostream> #include <cstdio> #i ...

  6. truetype技术和矢量字库的技术原理及实现(转)

    源:truetype技术和矢量字库的技术原理及实现 广泛汉字矢量字库(HZKSLxxJ)格式             在矢量字库中,每个汉字都是以128   X   128点阵制成矢量数据.每个汉字  ...

  7. 《算法导论》习题2.3-6 改进的InsertSort

    InsertSort中有关键的一步是把当前元素A[i]插入到已经排好序的A[1,i-1]的合适的位置上,在原始的InsertSort算法中, 采用的是从后往前一步一步查找的方法,习题2.3-6要求利用 ...

  8. XCode里的模拟器到底在哪里?我的App被放到哪里了?如何寻找真机的沙盒文件?

    一. 开发iOS,必然少不了和XCode这个家伙打交道.平时我们调试自己的App的时候,最常用到的就是模拟器Simulator了,调试的时候,我们的App会自动被XCode安装到模拟器中去,不过: 你 ...

  9. JV的DOM操作

    一.基本概念 :是文档对象模型,这种模型为树模型:文档指标签文档:对象是指文档中每个元素:模型是指抽象化的东西. :.Windows对象操作:.属性:opener:(打开当前窗口的原窗口.)dialo ...

  10. 企业建站http://www.douco.com/

    http://www.douco.com/ 非常方便的,搭建简单的企业网站