QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#163628 | #6867. String Problem | jrjyy# | AC ✓ | 1ms | 3732kb | C++20 | 482b | 2023-09-04 13:08:51 | 2023-09-04 13:08:52 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
void solve() {
std::string s;
std::cin >> s;
int ans = 0;
for (int l = 0, r; l < int(s.size()); l = r) {
for (r = l; r < int(s.size()) && s[r] == s[l]; ++r);
ans += r - l - 1;
}
std::cout << ans << '\n';
}
int main() {
std::cin.tie(nullptr)->sync_with_stdio(false);
int t;
std::cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3732kb
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