Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <cstdio>
- #include <vector>
- #include <iostream>
- #include <algorithm>
- using namespace std;
- int main() {
- int Q, len, counter;
- string str;
- cin >> Q;
- for (int i = 0; i < Q; i++){
- counter = 0;
- cin >> len >> str;
- for (int j = 1; j < len + 1; j++){
- if (str[j] == str[j-1]) { counter++; }
- }
- cout << counter << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment