Burger Stand (UVA 13048) by beet1333
Contest: 3738    RunID: 20173592    Status: Accepted    Date: Sat Oct 14 13:51:52 JST 2017


#include<bits/stdc++.h>

using namespace std;

struct BeetAizu
{
  BeetAizu()
  {

  }

  void run()
  {
    string S;
    cin >> S;
    S += "**";

    int ret = 0;
    for(int i = 0; i < S.size(); i++) {
      if(S[i] == '-') {
        bool flag = false;
        flag |= S[i + 1] == 'B';
        flag |= S[i + 2] == 'B';
        flag |= S[i + 1] == 'S';
        flag |= S[i - 1] == 'S';
        ret += 1 ^ flag;
      }
    }
    cout << ret << endl;
  }
};

int main()
{
  BeetAizu beet;
  int T;
  cin >> T;
  for(int i = 1; i <= T; i++) {
    cout << "Case " << i << ": ";
    beet.run();
  }
}