Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int t;
- cin>>t;
- while(t--)
- {
- int n;
- string s;
- cin >> n >> s;
- string x = "";
- x += s[0];
- for (int i = 1; i < s.size(); i++)
- {
- if (s[i] != x.back())
- x += s[i];
- }
- int cnt = 0;
- if (x.size() < 3)
- {
- cout << 0 << endl;
- continue;
- }
- for (int i = 0; i <= x.size() - 3; i++)
- {
- if (x[i] == ':' && x[i + 2] == ':' && x[i + 1] == ')')
- cnt++;
- }
- cout << cnt << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment