Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<math.h>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- string s;
- string niza[n];
- for(int i=0;i<n;i++)
- {
- cin>>niza[i];
- }
- long long l=0;
- int d=0;
- long long rez=0;
- for(int i=0;i<n;i++)
- {
- if(niza[i]=="LL" )
- {
- l++;
- }
- if(niza[i]=="DD")
- {
- l--;
- }
- rez+=fabs(l);
- }
- cout<<rez;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement