#include< bits/stdc++.h >
using namespace std;
int main()
{
int n;
string s;
cin >> n;
while(n--) {
stack< char >st;
int ans = 0;
cin >> s;
for(auto ch: s) {
if(ch == '<') st.push(ch);
else if( !st.empty() and ch == '>' ) {
ans++;
st.pop();
}
}
cout << ans << endl;
}
return 0;
}
using namespace std;
int main()
{
int n;
string s;
cin >> n;
while(n--) {
stack< char >st;
int ans = 0;
cin >> s;
for(auto ch: s) {
if(ch == '<') st.push(ch);
else if( !st.empty() and ch == '>' ) {
ans++;
st.pop();
}
}
cout << ans << endl;
}
return 0;
}