#include #include using namespace std; int main(){ int i,n,count=0; char j; cin>>n; int a[n]; for(i=0;i>j; if(j=='U') count++; else count--; a[i]=count; } for(i=1,count=0;i