output_description: Print the minimum number of new stones that Jiro needs to place for his
  purpose.
  
  * * *
input_description: The input is given from Standard Input in the following format:
  
      
      
      S
attempt: import sys
  import math
  import collections
  import itertools
  import array
  import inspect
  
  # Set max recursion limit
  sys.setrecursionlimit(1000000)
  
  
  # Debug output
  def chkprint(*args):
      names = {id(v): k for k, v in inspect.currentframe().f_back.f_locals.items()}
      print(", ".join(names.get(id(arg), "???") + " = " + repr(arg) for arg in args))
  
  
  # Binary converter
  def to_bin(x):
      return bin(x)[2:]
  
  
  def li_input():
      return [int(_) for _ in input().split()]
  
  
  def gcd(n, m):
      if n % m == 0:
          return m
      else:
          return gcd(m, n % m)
  
  
  def gcd_list(L):
      v = L[0]
  
      for i in range(1, len(L)):
          v = gcd(v, L[i])
  
      return v
  
  
  def lcm(n, m):
      return (n * m) // gcd(n, m)
  
  
  def lcm_list(L):
      v = L[0]
  
      for i in range(1, len(L)):
          v = lcm(v, L[i])
  
      return v
  
  
  # Width First Search (+ Distance)
  def wfs_d(D, N, K):
      """
      D: 隣接行列(距離付き)
      N: ノード数
      K: 始点ノード
      """
  
      dfk = [-1] * (N + 1)
      dfk[K] = 0
  
      cps = [(K, 0)]
      r = [False] * (N + 1)
      r[K] = True
      while len(cps) != 0:
          n_cps = []
          for cp, cd in cps:
              for i, dfcp in enumerate(D[cp]):
                  if dfcp != -1 and not r[i]:
                      dfk[i] = cd + dfcp
                      n_cps.append((i, cd + dfcp))
                      r[i] = True
  
          cps = n_cps[:]
  
      return dfk
  
  
  # Depth First Search (+Distance)
  def dfs_d(v, pre, dist):
      """
      v:  現在のノード
      pre: １つ前のノード
      dist: 現在の距離
  
      以下は別途用意する
      D: 隣接リスト(行列ではない)
      D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
      """
  
      global D
      global D_dfs_d
  
      D_dfs_d[v] = dist
  
      for next_v, d in D[v]:
          if next_v != pre:
              dfs_d(next_v, v, dist + d)
  
      return
  
  
  def sigma(N):
      ans = 0
      for i in range(1, N + 1):
          ans += i
      return ans
  
  
  class Combination:
      def __init__(self, n, mod):
  
          g1 = [1, 1]
          g2 = [1, 1]
          inverse = [0, 1]
          for i in range(2, n + 1):
              g1.append((g1[-1] * i) % mod)
              inverse.append((-inverse[mod % i] * (mod // i)) % mod)
              g2.append((g2[-1] * inverse[-1]) % mod)
          self.MOD = mod
          self.N = n
          self.g1 = g1
          self.g2 = g2
          self.inverse = inverse
  
      def __call__(self, n, r):
          if r < 0 or r > n:
              return 0
          r = min(r, n - r)
          return self.g1[n] * self.g2[r] * self.g2[n - r] % self.MOD
  
  
  # --------------------------------------------
  
  dp = None
  
  
  def main():
      S = input()
  
      pre_s = S[0]
      ans = 0
  
      for i in range(1, len(S)):
          if S[i] != pre_s:
              ans += 1
              pre_s = S[i]
  
      print(ans)
  
  
  main()
  
problem_description: Statement
  
  Two foxes Jiro and Saburo are playing a game called _1D Reversi_. This game is
  played on a board, using black and white stones. On the board, stones are
  placed in a row, and each player places a new stone to either end of the row.
  Similarly to the original game of Reversi, when a white stone is placed, all
  black stones between the new white stone and another white stone, turn into
  white stones, and vice versa.
  
  In the middle of a game, something came up and Saburo has to leave the game.
  The state of the board at this point is described by a string S. There are |S|
  (the length of S) stones on the board, and each character in S represents the
  color of the i-th (1 ≦ i ≦ |S|) stone from the left. If the i-th character in
  S is `B`, it means that the color of the corresponding stone on the board is
  black. Similarly, if the i-th character in S is `W`, it means that the color
  of the corresponding stone is white.
  
  Jiro wants all stones on the board to be of the same color. For this purpose,
  he will place new stones on the board according to the rules. Find the minimum
  number of new stones that he needs to place.
samples: [{"input": "BBBWW", "output": "1\n    \n\nBy placing a new black stone to the right end of the row of stones, all white\nstones will become black. Also, by placing a new white stone to the left end\nof the row of stones, all black stones will become white.\n\nIn either way, Jiro's purpose can be achieved by placing one stone.\n\n* * *"}, {"input": "WWWWWW", "output": "0\n    \n\nIf all stones are already of the same color, no new stone is necessary.\n\n* * *"}, {"input": "WBWBWBWBWB", "output": "9"}]