Burger Stand (UVA 13048) by return_zukky
Contest: 3738    RunID: 20173758    Status: Accepted    Date: Sat Oct 14 14:22:04 JST 2017


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

int memo[55];

int main(){

  int t,T=1;
  cin>>t;
  
  while(t--){
    
    string s;
    
    cin>>s;

    memset(memo,0,sizeof(memo));

    for(int i=0;i<s.size();i++){
      
      if(s[i]!='-') memo[i]=1;

      if(s[i]=='S'){
	if(i-1>=0) memo[i-1]=1;
	if(i+1<s.size()) memo[i+1]=1;
      }

      if(s[i]=='B'){
	if(i-1>=0) memo[i-1]=1;
	if(i-2>=0) memo[i-2]=1;
      }

    }

    int ans=0;

    for(int i=0;i<s.size();i++)
      if(!memo[i]) ans++;
    
    cout<<"Case "<<T++<<": ";
    cout<<ans<<endl;
  }
  
  return 0;
}