forked from gmendonca/uri-problem-solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1069.cpp
29 lines (26 loc) · 738 Bytes
/
1069.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
int main(){
int n, j, esq, dir;
char linha[1001];
scanf("%d",&n);
for(int i = 0; i < n; i++){
scanf("%s",&linha);
dir = 0;
j = 0;
esq = 0;
dir = 0;
while(true){
if(linha[j] == '\0') break;
if(linha[j] == '<') esq++;
if(linha[j] == '>'){
if(esq > 0){
dir++;
esq--;
}
}
j++;
}
printf("%d\n", dir);
}
return 0;
}