Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.Scanner;
- //import java.io.File;
- import static sun.nio.ch.IOStatus.EOF;
- public class Main {
- public static void main(String[] args) throws IOException {
- Scanner in=new Scanner(System.in);
- InputStreamReader es=new InputStreamReader(System.in);
- BufferedReader br=new BufferedReader(es);
- int o=in.nextInt();
- for (int y = 0; y <o ; y++) {
- String w=in.next();
- int count=0;
- char[] chars=w.toCharArray();
- for (int i = 0; i <chars.length ; i++) {
- if(chars[i]=='<'){
- for (int j = i; j <chars.length ; j++) {
- if(chars[j]=='>'){
- count++;
- chars[j]='0';
- break;
- }
- }
- }
- }
- System.out.println(count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement