QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#166864 | #6867. String Problem | PPP# | AC ✓ | 3ms | 3812kb | C++17 | 663b | 2023-09-06 19:36:06 | 2023-09-06 19:36:08 |
Judging History
answer
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int n;
ll k;
const int maxN = 1e5 + 10;
int A[maxN];
int B[maxN];
void solve() {
string s;
cin >> s;
int n = s.size();
n--;
for (int i = 1; i < s.size(); i++) {
if (s[i] != s[i - 1]) n--;
}
cout << n << '\n';
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#ifdef DEBUG
freopen("input.txt", "r", stdin);
#endif
int tst;
cin >> tst;
while (tst--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3812kb
input:
16 abcdefg pqtcuxgggzxwviimecjcewjagmkozprogmrcjzjsagqvozkubvxitikzuxpwogkuudzgfiyfqodgnparkxbdilceisaxantvqsdxcbdspgyfvzyhyzkgkolvinujangtijqkkvfbddiaeghffrnsgapoojzqwhlgsetezygfdofkvnpcgewohlfvuentobzgfslgstlwhrgeexjmbfbirgflmvecwgjdawjtpvrymxfswoezthimnpycmeekmnnnlxgaszzewgyuuctpkdczvcdhgistxfijc...
output:
0 3845 3864 3765 25214 25033 1 1 24911 5041 4981 9999 9999 3829 3872 3856
result:
ok 16 lines