泰州市程序设计比赛 高中组第四题
#include <bits/stdc++.h>
using namespace std;
string s;
void work(int left,int right){
if(left==right) {
switch(s[right] ){
case 'B': cout << 0;break;
case 'I': cout << 1;break;
}
return;
}
int len = (right-left)/2;
work( left , left+len-1 );
work( left+len, right-1);
}
int main(){
cin >> s;
int len= s.length();
work(0, len-1);
return 0;
}