Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdio>
- #include<string>
- #include<cstring>
- using namespace std;
- int main()
- {
- freopen("cowfind.in","r","stdin");
- freopen("cowfind.out","w","stdout");
- string s;
- int len,res=0,cnt=0;
- cin>>s;
- len=s.size();
- for(int i=0; i<len-1; i++)
- {
- if(s[i]=='(' && (s[i]==s[i+1]))cnt++;
- else if(s[i]==')' && (s[i]==s[i+1]))
- {
- res+=cnt;
- }
- }
- cout<<res<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement