#include <iostream> #include <string.h> #include<bits/stdc++.h> using namespace std; int main(){ int t; cin>>t; while(t--){ char A[1000002]; scanf("%s",A); long long int x=strlen(A); long long int i,a=0,b=0,c; for(i=0; i<x; i++) { if(A[i]=='<') { a++; } else { a--; } if(a==0) { b=i+1; } else if(a<0) { break; } } cout<<b<<"\n"; } return 0; }
Asked by: Manish_Kumar_Savita on April 7, 2019, 6:34 p.m. Last updated on April 7, 2019, 6:34 p.m.