Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
hackercup / 2021 /round1 /weak_typing_ch1.cpp
wjomlex's picture
2021 Problems
d3f4f72 verified
raw
history blame
444 Bytes
#include <iostream>
using namespace std;
int N;
string W;
int solve() {
cin >> N >> W;
int p = -1, ans = 0;
for (int i = 0; i < N; i++) {
if (W[i] == 'F') {
continue;
}
if (p >= 0 && W[i] != W[p]) {
ans++;
}
p = i;
}
return ans;
}
int main() {
int T;
cin >> T;
for (int t = 1; t <= T; t++) {
cout << "Case #" << t << ": " << solve() << endl;
}
return 0;
}