Burger Stand (UVA 13048) by ynu_a
Contest: 3738    RunID: 20173684    Status: Accepted    Date: Sat Oct 14 14:09:26 JST 2017


#include<bits/stdc++.h>
using namespace std;

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX

typedef long long ll;
typedef pair<int, int> ii;

bool in(int a, int b){
  return (0 <= a && a < b);
}

int main(){

  int t;
  cin >> t;

  rep(n, t){
    string s;
    cin >> s;
    int ans = 0;
    rep(i, s.size()){
      if(s[i] != '-') continue;//1, 2, 5
      if(in(i+1, s.size()) && s[i+1] == 'B') continue;
      if(in(i+2, s.size()) && s[i+2] == 'B') continue;
      if(in(i+1, s.size()) && s[i+1] == 'S') continue;
      if(in(i-1, s.size()) && s[i-1] == 'S') continue;
      ans++;
    }
    cout << "Case " << n+1 << ": " <<  ans << endl;
  }

  return 0;
}