//my code shows wrong answer after submission, i’m unable to find the test case for that it is wrong
here is submission
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
ios_base::sync_with_stdio(false);
cin.tie(NULL);
stack r;
int t;
cin>>t;
for(int i=0;i<t;i++)
{
string s;
int l=0,m=0;
cin>>s;
if(s[0]!=‘>’)
{
while(m<s.size())
{
if(s[m]==‘<’)
r.push(s[m]);
if(s[m]==‘>’)
{
if(!r.empty())
{
r.pop();
l++;
}
}
m++;
}
}
if(l=='0')
cout<<"0"<<endl;
else
cout<<l*2<<endl;
while(!r.empty())
{
r.pop();
}
while(!s.empty())
{
s.pop_back();
}
}
return 0;
}