Burger Stand (UVA 13048) by UKUNICHIA
Contest: 3738    RunID: 20173566    Status: Accepted    Date: Sat Oct 14 13:46:17 JST 2017


#include<bits/stdc++.h>
using namespace std;
using Int = long long;
signed main(){
  int T;
  cin>>T;
  for(int t=1;t<=T;t++){
    cout<<"Case "<<t<<": ";
    string str;
    cin>>str;

    int ans = 0;
    int n = str.size();
    for(int i=0;i<(int)str.size();i++){
      if(str[i]!='-') continue;
      if(i+1<n && (str[i+1] == 'B' || str[i+1] == 'S')) continue;
      if(i+2<n && str[i+2] == 'B') continue;
      if(i-1>=0 && str[i-1] == 'S') continue;
      ans ++;
    }
    cout<<ans<<endl;
  }
  return 0;
}