#include <bits/stdc++.h>
using namespace std;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define forn(i,n) forr(i,0,n)
#define sz(c) ((int)c.size())
#define zero(v) memset(v, 0, sizeof(v))
#define forall(it,v) for(auto it=v.begin();it!=v.end();++it)
#define pb push_back
#define fst first
#define snd second
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> ii;
#define dforn(i,n) for(int i=n-1; i>=0; i--)
#define dprint(v) cout << #v"=" << v << endl
#define endl "\n"

const int MAXN=300000;

bool a[MAXN];

int main() {
    string s;
	cin >> s;
	int n = s.length();
	forn(i,n)
		a[i] = s[i] == 'W';
	int i=n-1;
	ll count = 0;
	while(i != 0){
		if(a[i] && !a[i-1]){
			swap(a[i], a[i-1]);
			count++;
			i+=2;
		}
		i--;
	}	
	cout << count << endl;
	return 0;
}
