#include<iostream>
#include<string>
#include<string.h>
using namespace std;
int dp[7][7];
string s;
int f(int i,int j)
{
if(i>=j)return 0;
if(dp[i][j]!=-1)return dp[i][j];
if(s[i]==s[j])
{
dp[i][j]=f(i+1,j-1);
}
else
{
dp[i][j]=min(f(i+1,j),f(i,j-1))+1;
}
return dp[i][j];
}
int main()
{
s="bb";
memset(dp,-1,49*4);
cout<<f(0,1);
}