Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- ifstream in("cow.in");
- ofstream out("cow.out");
- int n;
- cin>>n;
- char input;
- long long c=0;
- long long co=0;
- long long result=0;
- cin>>input;
- for(int i=0;i<n;i++)
- {
- cin>>input;
- if(input=='C')
- c++;
- else if(input=='O')
- co+=c;
- else
- result+=co;
- }
- cout<<result;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement