Language: C++

import javafx.css.Match;

import java.io.*;
import java.math.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

class Main {

    private static final PrintWriter out = new PrintWriter(System.out);
    private static final Scanner scanner = new Scanner(System.in);
    private static int[] dx = {1, 0, -1, 0, 1, 1, -1, -1};
    private static int[] dy = {0, 1, 0, -1, 1, -1, 1, -1};
    private static int INF = 0x3f3f3f3f;

    public static void main(String[] args) {
        // From IntelliJ IDEA

        String s = fgetStr();
        int cnt = 0;
        while ( s.contains("BW") ) {
            cnt++;
            s = s.replaceFirst("BW", "WB");
        }
        println(cnt);

        suomi();
    }

    private static boolean isMovable( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
    private static String fgetStr(){
        return FastScanner.next();
    }
    private static String fgetLine(){
        return FastScanner.nextLine();
    }
    private static char fgetChar(){
        return fgetStr().charAt(0);
    }
    private static int fgetInt(){
        return FastScanner.nextInt();
    }
    private static long fgetLong(){
        return FastScanner.nextLong();
    }
    private static double fgetDouble(){
        return FastScanner.nextDouble();
    }
    private static BigInteger fgetBig(){
        return new BigInteger(fgetStr());
    }
    private static String reverseStr(String str){
        return new StringBuffer(str).reverse().toString();
    }
    private static void println(Object a){
        out.println(a);
    }
    private static void print(Object a){
        out.print(a);
    }
    private static void printf(String string, Object... args) {
        out.printf(string, args);
    }
    private static void suomi(){
        out.flush();
    }
    private static long pow ( long x, long n ) {
        final long MOD = 1000000007;
        long ans = 1;
        while ( n > 0 ) {
            if ( ( n & 1 ) == 1 ) {
                ans = (ans * x) % MOD;
            }
            x = ( x * x ) % MOD;
            n >>= 1;
        }
        return ans;
    }
    private static long gcd(long x, long y) {
        return x % y == 0 ? y : gcd(y, x % y);
    }
    private static long lcm(long x, long y) {
        return ( x / gcd(x, y) * y);
    }
}

class FastScanner {

    private static final InputStream in = System.in;
    private static final byte[] buffer = new byte[1024];
    private static int ptr = 0;
    private static int bufferLength = 0;
    private static boolean hasNextByte() {
        if (ptr < bufferLength) {
            return true;
        }else{
            ptr = 0;
            try {
                bufferLength = in.read(buffer);
            } catch ( IOException e) {
                e.printStackTrace();
            }
            if (bufferLength <= 0) {
                return false;
            }
        }
        return true;
    }
    private static int readByte() {
        if (hasNextByte()) return buffer[ptr++];
        else return -1;
    }
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    private static boolean hasNext() {
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
        return hasNextByte();
    }
    static String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    static String nextLine() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b) || b == 32) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    static long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    static int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    static double nextDouble() {
        return Double.parseDouble(next());
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import javafx.css.Match;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.io.*;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.math.*;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
    5 | import java.util.*;
      | ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
    6 | import java.util.regex.Matcher;
      | ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
    7 | import java.util.regex.Pattern;
      | ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:12: error: expected ':' before 'static'
   11 |     private static final PrintWriter out = new PrintWriter(System.out);
      |            ^~~~~~~
      |            :
a.cc:11:20: error: 'final' does not name a type
   11 |     private static final PrintWriter out = new PrintWriter(System.out);
      |                    ^~~~~
a.cc:12:12: error: expected ':' before 'static'
   12 |     private static final Scanner scanner = new Scanner(System.in);
      |            ^~~~~~~
      |            :
a.cc:12:20: error: 'final' does not name a type
   12 |     private static final Scanner scanner = new Scanner(System.in);
      |                    ^~~~~
a.cc:13:12: error: expected ':' before 'static'
   13 |     private static int[] dx = {1, 0, -1, 0, 1, 1, -1, -1};
      |            ^~~~~~~
      |            :
a.cc:13:23: error: expected unqualified-id before '[' token
   13 |     private static int[] dx = {1, 0, -1, 0, 1, 1, -1, -1};
      |                       ^
a.cc:14:12: error: expected ':' before 'static'
   14 |     private static int[] dy = {0, 1, 0, -1, 1, -1, 1, -1};
      |            ^~~~~~~
      |            :
a.cc:14:23: error: expected unqualified-id before '[' token
   14 |     private static int[] dy = {0, 1, 0, -1, 1, -1, 1, -1};
      |                       ^
a.cc:15:12: error: expected ':' before 'static'
   15 |     private static int INF = 0x3f3f3f3f;
      |            ^~~~~~~
      |            :
a.cc:15:24: error: ISO C++ forbids in-class initialization of non-const static member 'Main::INF'
   15 |     private static int INF = 0x3f3f3f3f;
      |                        ^~~
a.cc:17:11: error: expected ':' before 'static'
   17 |     public static void main(String[] args) {
      |           ^~~~~~~
      |           :
a.cc:17:29: error: 'String' has not been declared
   17 |     public static void main(String[] args) {
      |                             ^~~~~~
a.cc:17:38: error: expected ',' or '...' before 'args'
   17 |     public static void main(String[] args) {
      |                                      ^~~~
a.cc:31:12: error: expected ':' before 'static'
   31 |     private static boolean isMovable( int x, int y, int w, int h ) {
      |            ^~~~~~~
      |            :
a.cc:31:20: error: 'boolean' does not name a type; did you mean 'bool'?
   31 |     private static boolean isMovable( int x, int y, int w, int h ) {
      |                    ^~~~~~~
      |                    bool
a.cc:34:12: error: expected ':' before 'static'
   34 |     private static String fgetStr(){
      |            ^~~~~~~
      |            :
a.cc:34:20: error: 'String' does not name a type
   34 |     private static String fgetStr(){
      |                    ^~~~~~
a.cc:37:12: error: expected ':' before 'static'
   37 |     private static String fgetLine(){
      |            ^~~~~~~
      |            :
a.cc:37:20: error: 'String' does not name a type
   37 |     private static String fgetLine(){
      |                    ^~~~~~
a.cc:40:12: error: expected ':' before 'static'
   40 |     private static char fgetChar(){
      |            ^~~~~~~
      |            :
a.cc:43:12: error: expected ':' before 'static'
   43 |     private static int fgetInt(){
      |            ^~~~~~~
      |            :
a.cc:46:12: error: expected ':' before 'static'
   46 |     private static long fgetLong(){
      |            ^~~~~~~
      |            :
a.cc:49:12: error: expected ':' before 'static'
   49 |     private static double fgetDouble(){
      |            ^~~~~~~
      |            :
a.cc:52:12: error: expected ':' before 'static'
   52 |     private static BigInteger fgetBig(){
      |            ^~~~~~~
      |            :
a.cc:52:20: error: 'BigInteger' does not name a type
   52 |     private static BigInteger fgetBig(){
      |                    ^~~~~~~~~~
a.cc:55:12: error: expected ':' before 'static'
   55 |     private static String reverseStr(String str){
      |            ^~~~~~~
      |            :
a.cc:55:20: error: 'String' does not name a type
   55 |     private static String reverseStr(String str){
      |                    ^~~~~~
a.cc:58:12: error: expected ':' before 'static'
   58 |     private static void println(Object a){
      |            ^~~~~~~
      |            :
a.cc:58:33: error: 'Object' has not been declared
   58 |     private static void println(Object a){
      |                                 ^~~~~~
a.cc:61:12: error: expected ':' before 'static'
   61 |     private static void print(Object a){
      |            ^~~~~~~
      |            :
a.cc:61:31: error: 'Object' has not been declared
   61 |     private static void print(Object a){
      |                               ^~~~~~
a.cc:64:12: error: expected ':' before 'static'
   64 |     private static void printf(String string, Object... args) {
      |            ^~~~~~~
      |            :
a.cc:64:32: error: 'String' has not been declared
   64 |     private static void printf(String string, Object... args) {
      |                                ^~~~~~
a.cc:64:47: error: 'Object' has not been declared
   64 |     private static void printf(String string, Object... args) {
      |                                               ^~~~~~
a.cc:64:57: error: expansion pattern 'int' contains no parameter packs
   64 |     private static void printf(String string, Object... args) {
      |                                                         ^~~~
a.cc:67:12: error: expected ':' before 'static'
   67 |     private static void suomi(){
      |            ^~~~~~~
      |            :
a.cc:70:12: error: expected ':' before 'static'
   70 |     private static long pow ( long x, long n ) {
      |            ^~~~~~~
      |            :
a.cc:82:12: error: expected ':' before 'static'
   82 |     private static long gcd(long x, long y) {
      |            ^~~~~~~
      |            :
a.cc:85:12: error: expected ':' before 'static'
   85 |     private static long lcm(long x, long y) {
      |            ^~~~~~~
      |            :
a.cc:88:2: error: expected ';' after class definition
   88 | }
      |  ^
      |  ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:20:9: error: 'String' was not declared in this scope
   20 |         String s = fgetStr();
      |         ^~~~~~
a.cc:22:17: error: 's' was not declared in this scope
   22 |         while ( s.contains("BW") ) {
      |                 ^
a.cc: In static member function 'static char Main::fgetChar()':
a.cc:41:16: error: 'fgetStr' was not declared in this scope
   41 |         return fgetStr().charAt(0);
      |                ^~~~~~~
a.cc: In static member function 'static int Main::fgetInt()':
a.cc:44:16: error: 'FastScanner' was not declared in this scope
   44 |         return FastScanner.nextInt();
      |                ^~~~~~~~~~~
a.cc: In static member function 'static long int Main::fgetLong()':
a.cc:47:16: error: 'FastScanner' was not declared in this scope
   47 |         return FastScanner.nextLong();
      |                ^~~~~~~~~~~
a.cc: In static member function 'static double Main::fgetDouble()':
a.cc:50:16: error: 'FastScanner' was not declared in this scope
   50 |         return FastScanner.nextDouble();
      |                ^~~~~~~~~~~
a.cc: In static member function 'static void Main::println(int)':
a.cc:59:9: error: 'out' was not declared in this scope
   59 |         out.println(a);
      |         ^~~
a.cc: In static member function 'static void Main::print(int)':
a.cc:62:9: error: 'out' was not declared in this scope
   62 |         out.print(a);
      |         ^~~
a.cc: In static member function 'static void Main::printf(...)':
a.cc:65:9: error: 'out' was not declared in this scope
   65 |         out.printf(string, args);
      |         ^~~
a.cc:65:28: error: 'args' was not declared in this scope
   65 |         out.printf(string, args);
      |                            ^~~~
a.cc: In static member function 'static void Main::suomi()':
a.cc:68:9: error: 'out' was not declared in this scope
   68 |         out.flush();
      |         ^~~
a.cc: In static member function 'static long int Main::pow(long int, long int)':
a.cc:71:9: error: 'final' was not declared in this scope
   71 |         final long MOD = 1000000007;
      |         ^~~~~
a.cc:75:35: error: 'MOD' was not declared in this scope
   75 |                 ans = (ans * x) % MOD;
      |                                   ^~~
a.cc:77:29: error: 'MOD' was not declared in this scope
   77 |             x = ( x * x ) % MOD;
      |                             ^~~
a.cc: At global scope:
a.cc:92:12: error: expected ':' before 'static'
   92 |     private static final InputStream in = System.in;
      |            ^~~~~~~
      |            :
a.cc:92:20: error: 'final' does not name a type
   92 |     private static final InputStream in = System.in;
      |                    ^~~~~
a.cc:93:12: error: expected ':' before 'static'
   93 |     private static final byte[] buffer = new byte[1024];
      |            ^~~~~~~
      |            :
a.cc:93:20: error: 'final' does not name a type
   93 |     private static final byte[] buffer = new byte[1024];
      |                    ^~~~~
a.cc:94:12: error: expected ':' before