提交时间:2023-05-07 09:22:06

运行 ID: 16667

#include<bits/stdc++.h> using namespace std; int main() { int h,s; string str; cin>>h>>s>>str; for(int i=0;i<str .size();i++){ if(str[i]=='u'){ if(s>0) s--; } else if(s<h)s++; } cout<<s; return 0; }