Run ID:62217
提交时间:2023-12-19 12:34:10
# include<iostream> # include<cstring> using namespace std; char y[105]; int h,s; int main(){ cin>>h>>s; cin>>y; for(int i=0;i<strlen(y);i++){ if(y[i]=='u' and s!=0)s--; if(y[i]=='d' and s!=h)s++; } cout<<s; return 0; }