magical string 题解:
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin>>n;
n--;
while(n--){
string str;cin>>str;
int sz=str.size();int res=0;
for(int i=0;i<sz;i++){
if(i<sz/2&&str[i]=='<') res++;
if(i>=sz/2&&str[i]=='>') res++;
}
cout<<res<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发