node_ids
listlengths
4
1.4k
edge_index
listlengths
1
2.22k
text
listlengths
4
1.4k
source
stringlengths
14
427k
[ 7, 15, 13, 0, 13, 4, 13, 0, 13, 4, 18, 13, 13, 17, 17, 13, 0, 13, 4, 18, 13, 13, 17, 17, 13, 4, 13, 2, 4, 13, 13, 17, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 36, 4 ], [ 39, 8 ], [ 37, 15 ], [ 33, 17 ], [ 40, 24 ], [ 37, 24 ], [ 34, 30 ], [ 40, 30 ], [ 37, 30 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ] ]
[ "import re\n\nS = input()\nS = re.sub('[B]{2,}', 'B', S)\nS = re.sub('[W]{2,}', 'W', S)\n\nprint(len(S)-1)", "import re", "re", "S = input()", "S", "input()", "input", "S = re.sub('[B]{2,}', 'B', S)", "S", "re.sub('[B]{2,}', 'B', S)", "re.sub", "re", "sub", "'[B]{2,}'", "'B'", "S", "S = re.sub('[W]{2,}', 'W', S)", "S", "re.sub('[W]{2,}', 'W', S)", "re.sub", "re", "sub", "'[W]{2,}'", "'W'", "S", "print(len(S)-1)", "print", "len(S)-1", "len(S)", "len", "S", "1", "S = re.sub('[W]{2,}', 'W', S)", "re.sub('[W]{2,}', 'W', S)", "S", "S = input()", "input()", "S", "S = re.sub('[B]{2,}', 'B', S)", "re.sub('[B]{2,}', 'B', S)", "S" ]
import re S = input() S = re.sub('[B]{2,}', 'B', S) S = re.sub('[W]{2,}', 'W', S) print(len(S)-1)
[ 7, 15, 13, 15, 15, 13, 6, 13, 12, 13, 0, 13, 18, 13, 13, 13, 18, 13, 13, 0, 18, 13, 13, 4, 13, 18, 13, 13, 4, 13, 13, 4, 13, 4, 18, 18, 13, 13, 13, 17, 0, 13, 18, 4, 18, 18, 13, 13, 13, 39, 17, 0, 18, 13, 13, 13, 18, 13, 13, 13, 4, 18, 13, 13, 13, 13, 23, 13, 23, 13, 23, 13, 12, 13, 0, 13, 17, 0, 13, 17, 4, 18, 13, 13, 13, 13, 23, 13, 12, 13, 0, 13, 17, 0, 13, 17, 4, 18, 13, 13, 13, 13, 23, 13, 12, 13, 0, 13, 17, 0, 13, 17, 4, 18, 13, 13, 13, 13, 23, 13, 18, 13, 13, 12, 13, 0, 13, 4, 13, 4, 13, 0, 13, 17, 42, 2, 13, 4, 13, 13, 14, 2, 18, 13, 13, 18, 13, 2, 13, 17, 24, 18, 13, 13, 0, 13, 17, 4, 13, 2, 4, 13, 13, 17, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 6, 13 ]
[ [ 12, 11 ], [ 16, 15 ], [ 23, 20 ], [ 11, 22 ], [ 28, 25 ], [ 15, 27 ], [ 69, 30 ], [ 20, 35 ], [ 11, 37 ], [ 42, 41 ], [ 20, 45 ], [ 11, 47 ], [ 55, 52 ], [ 11, 54 ], [ 11, 55 ], [ 59, 56 ], [ 15, 58 ], [ 15, 59 ], [ 67, 62 ], [ 41, 64 ], [ 71, 65 ], [ 67, 67 ], [ 69, 69 ], [ 71, 71 ], [ 76, 75 ], [ 79, 78 ], [ 87, 82 ], [ 9, 83 ], [ 75, 84 ], [ 78, 85 ], [ 87, 87 ], [ 92, 91 ], [ 95, 94 ], [ 103, 98 ], [ 9, 99 ], [ 91, 100 ], [ 94, 101 ], [ 103, 103 ], [ 108, 107 ], [ 111, 110 ], [ 119, 114 ], [ 9, 115 ], [ 107, 116 ], [ 110, 117 ], [ 119, 119 ], [ 127, 126 ], [ 133, 132 ], [ 132, 136 ], [ 155, 136 ], [ 126, 139 ], [ 126, 143 ], [ 132, 144 ], [ 155, 144 ], [ 126, 146 ], [ 132, 148 ], [ 155, 148 ], [ 126, 152 ], [ 132, 153 ], [ 155, 153 ], [ 156, 155 ], [ 126, 162 ], [ 172, 169 ] ]
[ "#\n# abc047 c\n#\n\nimport sys\nfrom io import StringIO\nimport unittest\n\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = \"\"\"BBBWW\"\"\"\n output = \"\"\"1\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = \"\"\"WWWWWW\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = \"\"\"WBWBWBWBWB\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)\n\n\ndef resolve():\n S = list(input())\n\n i = 1\n while i < len(S):\n if S[i] == S[i-1]:\n del S[i]\n else:\n i += 1\n\n print(len(S)-1)\n\n\nif __name__ == \"__main__\":\n # unittest.main()\n resolve()", "import sys", "sys", "from io import StringIO", "import unittest", "unittest", "class TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = \"\"\"BBBWW\"\"\"\n output = \"\"\"1\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = \"\"\"WWWWWW\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = \"\"\"WBWBWBWBWB\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)", "TestClass", "def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n ", "assertIO", "stdout, stdin = sys.stdout, sys.stdin", "stdout", "sys.stdout", "sys", "stdout", "stdin", "sys.stdin", "sys", "stdin", "sys.stdout, sys.stdin = StringIO(), StringIO(input)", "sys.stdout", "sys", "stdout", "StringIO()", "StringIO", "sys.stdin", "sys", "stdin", "StringIO(input)", "StringIO", "input", "resolve()", "resolve", "sys.stdout.seek(0)", "sys.stdout.seek", "sys.stdout", "sys", "stdout", "seek", "0", "out = sys.stdout.read()[:-1]", "out", "sys.stdout.read()[:-1]", "sys.stdout.read()", "sys.stdout.read", "sys.stdout", "sys", "stdout", "read", ":-1", "-1", "sys.stdout, sys.stdin = stdout, stdin", "sys.stdout", "sys", "stdout", "stdout", "sys.stdin", "sys", "stdin", "stdin", "self.assertEqual(out, output)", "self.assertEqual", "self", "assertEqual", "out", "output", "self", "self", "input", "input", "output", "output", "def test_入力例_1(self):\n input = \"\"\"BBBWW\"\"\"\n output = \"\"\"1\"\"\"\n self.assertIO(input, output)\n\n ", "test_入力例_1", "input = \"\"\"BBBWW\"\"\"", "input", "\"\"\"BBBWW\"\"\"", "output = \"\"\"1\"\"\"", "output", "\"\"\"1\"\"\"", "self.assertIO(input, output)", "self.assertIO", "self", "assertIO", "input", "output", "self", "self", "def test_入力例_2(self):\n input = \"\"\"WWWWWW\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n ", "test_入力例_2", "input = \"\"\"WWWWWW\"\"\"", "input", "\"\"\"WWWWWW\"\"\"", "output = \"\"\"0\"\"\"", "output", "\"\"\"0\"\"\"", "self.assertIO(input, output)", "self.assertIO", "self", "assertIO", "input", "output", "self", "self", "def test_入力例_3(self):\n input = \"\"\"WBWBWBWBWB\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)", "test_入力例_3", "input = \"\"\"WBWBWBWBWB\"\"\"", "input", "\"\"\"WBWBWBWBWB\"\"\"", "output = \"\"\"9\"\"\"", "output", "\"\"\"9\"\"\"", "self.assertIO(input, output)", "self.assertIO", "self", "assertIO", "input", "output", "self", "self", "unittest.TestCase", "unittest", "TestCase", "def resolve():\n S = list(input())\n\n i = 1\n while i < len(S):\n if S[i] == S[i-1]:\n del S[i]\n else:\n i += 1\n\n print(len(S)-1)", "resolve", "S = list(input())", "S", "list(input())", "list", "input()", "input", "i = 1", "i", "1", "while i < len(S):\n if S[i] == S[i-1]:\n del S[i]\n else:\n i += 1\n\n ", "i < len(S)", "i", "len(S)", "len", "S", "if S[i] == S[i-1]:\n del S[i]\n else:\n i += 1\n\n ", "S[i] == S[i-1]", "S[i]", "S", "i", "S[i-1]", "S", "i-1", "i", "1", "del S[i]", "S[i]", "S", "i", "i += 1", "i", "1", "print(len(S)-1)", "print", "len(S)-1", "len(S)", "len", "S", "1", "if __name__ == \"__main__\":\n # unittest.main()\n resolve()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "resolve()", "resolve", "def resolve():\n S = list(input())\n\n i = 1\n while i < len(S):\n if S[i] == S[i-1]:\n del S[i]\n else:\n i += 1\n\n print(len(S)-1)", "def resolve():\n S = list(input())\n\n i = 1\n while i < len(S):\n if S[i] == S[i-1]:\n del S[i]\n else:\n i += 1\n\n print(len(S)-1)", "resolve", "class TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = \"\"\"BBBWW\"\"\"\n output = \"\"\"1\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = \"\"\"WWWWWW\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = \"\"\"WBWBWBWBWB\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)", "class TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = \"\"\"BBBWW\"\"\"\n output = \"\"\"1\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = \"\"\"WWWWWW\"\"\"\n output = \"\"\"0\"\"\"\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = \"\"\"WBWBWBWBWB\"\"\"\n output = \"\"\"9\"\"\"\n self.assertIO(input, output)", "TestClass" ]
# # abc047 c # import sys from io import StringIO import unittest class TestClass(unittest.TestCase): def assertIO(self, input, output): stdout, stdin = sys.stdout, sys.stdin sys.stdout, sys.stdin = StringIO(), StringIO(input) resolve() sys.stdout.seek(0) out = sys.stdout.read()[:-1] sys.stdout, sys.stdin = stdout, stdin self.assertEqual(out, output) def test_入力例_1(self): input = """BBBWW""" output = """1""" self.assertIO(input, output) def test_入力例_2(self): input = """WWWWWW""" output = """0""" self.assertIO(input, output) def test_入力例_3(self): input = """WBWBWBWBWB""" output = """9""" self.assertIO(input, output) def resolve(): S = list(input()) i = 1 while i < len(S): if S[i] == S[i-1]: del S[i] else: i += 1 print(len(S)-1) if __name__ == "__main__": # unittest.main() resolve()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 40, 18, 13, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 2, 13, 17, 10, 18, 13, 10, 18, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 52, 2 ], [ 49, 6 ], [ 40, 9 ], [ 53, 11 ], [ 15, 14 ], [ 53, 19 ], [ 53, 23 ], [ 14, 24 ], [ 41, 25 ], [ 44, 25 ], [ 46, 27 ], [ 43, 30 ], [ 53, 32 ], [ 14, 33 ], [ 47, 37 ], [ 50, 37 ], [ 40, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ] ]
[ "s = input()\ncnt = 1\ncw = s[0]\nfor i in range(len(s)):\n if s[i] != cw: \n cnt += 1\n cw = s[i]\nprint(cnt - 1)", "s = input()", "s", "input()", "input", "cnt = 1", "cnt", "1", "cw = s[0]", "cw", "s[0]", "s", "0", "for i in range(len(s)):\n if s[i] != cw: \n cnt += 1\n cw = s[i]", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i] != cw: \n cnt += 1\n cw = s[i]", "s[i] != cw", "s[i]", "s", "i", "cw", "cnt += 1", "cnt", "1", "cw = s[i]", "cw", "s[i]", "s", "i", "print(cnt - 1)", "print", "cnt - 1", "cnt", "1", "cw = s[0]", "s[0]", "cw", "cw = s[i]", "s[i]", "cw", "cnt += 1", "1", "cnt", "cnt = 1", "1", "cnt", "s = input()", "input()", "s" ]
s = input() cnt = 1 cw = s[0] for i in range(len(s)): if s[i] != cw: cnt += 1 cw = s[i] print(cnt - 1)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 17, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 13, 14, 2, 13, 18, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 13, 10, 4, 13, 10, 18, 13, 10, 17, 13, 10, 4, 13, 10, 18, 13, 10, 17, 13 ]
[ [ 52, 2 ], [ 43, 6 ], [ 53, 9 ], [ 46, 12 ], [ 53, 14 ], [ 49, 17 ], [ 21, 20 ], [ 44, 24 ], [ 47, 27 ], [ 56, 27 ], [ 53, 29 ], [ 20, 30 ], [ 58, 32 ], [ 55, 35 ], [ 53, 37 ], [ 20, 38 ], [ 59, 41 ], [ 50, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ] ]
[ "s = input()\nnum = len(s)\n'''\nWBWBWBWBWB\n9ko\n'''\ntemp = s[0]\nans = 0\nfor i in range(1, num):\n if (temp == s[i]):\n pass\n else:\n ans += 1\n temp = s[i]\n\nprint(ans)", "s = input()", "s", "input()", "input", "num = len(s)", "num", "len(s)", "len", "s", "'''\nWBWBWBWBWB\n9ko\n'''", "temp = s[0]", "temp", "s[0]", "s", "0", "ans = 0", "ans", "0", "for i in range(1, num):\n if (temp == s[i]):\n pass\n else:\n ans += 1\n temp = s[i]", "i", "range(1, num)", "range", "1", "num", "if (temp == s[i]):\n pass\n else:\n ans += 1\n temp = s[i]", "temp == s[i]", "temp", "s[i]", "s", "i", "ans += 1", "ans", "1", "temp = s[i]", "temp", "s[i]", "s", "i", "print(ans)", "print", "ans", "num = len(s)", "len(s)", "num", "temp = s[0]", "s[0]", "temp", "ans = 0", "0", "ans", "s = input()", "input()", "s", "temp = s[i]", "s[i]", "temp", "ans += 1", "1", "ans" ]
s = input() num = len(s) ''' WBWBWBWBWB 9ko ''' temp = s[0] ans = 0 for i in range(1, num): if (temp == s[i]): pass else: ans += 1 temp = s[i] print(ans)
[ 7, 12, 13, 17, 0, 13, 39, 13, 39, 0, 13, 39, 17, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 13, 4, 13, 18, 13, 39, 17, 0, 13, 17, 14, 2, 13, 13, 0, 13, 17, 4, 18, 13, 13, 13, 4, 18, 13, 13, 13, 4, 18, 13, 13, 13, 0, 13, 17, 0, 13, 13, 4, 18, 13, 13, 13, 4, 18, 13, 13, 13, 29, 39, 13, 13, 13, 23, 13, 0, 13, 4, 13, 4, 13, 13, 13, 4, 13, 2, 4, 13, 13, 17, 10, 4, 13, 10, 12, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 6, 5 ], [ 8, 7 ], [ 11, 10 ], [ 15, 14 ], [ 77, 16 ], [ 20, 19 ], [ 77, 27 ], [ 32, 31 ], [ 14, 35 ], [ 59, 35 ], [ 39, 38 ], [ 7, 42 ], [ 19, 44 ], [ 56, 44 ], [ 38, 44 ], [ 5, 47 ], [ 14, 49 ], [ 59, 49 ], [ 10, 52 ], [ 57, 56 ], [ 60, 59 ], [ 7, 63 ], [ 56, 65 ], [ 38, 65 ], [ 19, 65 ], [ 5, 68 ], [ 59, 70 ], [ 14, 70 ], [ 77, 77 ], [ 103, 79 ], [ 98, 81 ], [ 103, 84 ], [ 103, 85 ], [ 101, 91 ], [ 103, 95 ], [ 103, 101 ], [ 103, 104 ] ]
[ "# https://atcoder.jp/contests/abc047/tasks/arc063_a\n# 連長圧縮すれば簡単\n# 圧縮後の文字列長-1となる\n\n\ndef run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n s_composed, s_sum = [], []\n s_idx = [0]\n pre = s[0]\n cnt = 1\n for i, ss in enumerate(s[1:], start=1):\n if pre == ss:\n cnt += 1\n else:\n s_sum.append(cnt)\n s_composed.append(pre)\n s_idx.append(i)\n cnt = 1\n pre = ss\n s_sum.append(cnt)\n s_composed.append(pre)\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx\n\n\n# def run_length_encoding(s):\n# '''連長圧縮を行う\n# s ... iterable object e.g. list, str\n# return\n# ----------\n# s_composed,s_num,s_idx\n# それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n# from itertools import groupby\n# s_composed, s_sum = [], []\n# s_idx = [0]\n# for k, v in groupby(s):\n# s_composed.append(k)\n# n = len(list(v))\n# s_sum.append(n)\n# s_idx.append(s_idx[-1] + n)\n\n# # assert len(s_sum) == len(s_composed)\n# return s_composed, s_sum, s_idx\n\n\nS_composed, _, _ = run_length_encoding(input())\nprint(len(S_composed) - 1)", "def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n s_composed, s_sum = [], []\n s_idx = [0]\n pre = s[0]\n cnt = 1\n for i, ss in enumerate(s[1:], start=1):\n if pre == ss:\n cnt += 1\n else:\n s_sum.append(cnt)\n s_composed.append(pre)\n s_idx.append(i)\n cnt = 1\n pre = ss\n s_sum.append(cnt)\n s_composed.append(pre)\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx\n\n\n# def run_length_encoding(s):\n# '''連長圧縮を行う\n# s ... iterable object e.g. list, str\n# return\n# ----------\n# s_composed,s_num,s_idx\n# それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n# from itertools import groupby\n# s_composed, s_sum = [], []\n# s_idx = [0]\n# for k, v in groupby(s):\n# s_composed.append(k)\n# n = len(list(v))\n# s_sum.append(n)\n# s_idx.append(s_idx[-1] + n)\n\n# # assert len(s_sum) == len(s_composed)\n# return s_composed, s_sum, s_idx", "run_length_encoding", "'''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''", "s_composed, s_sum = [], []", "s_composed", "[]", "s_sum", "[]", "s_idx = [0]", "s_idx", "[0]", "0", "pre = s[0]", "pre", "s[0]", "s", "0", "cnt = 1", "cnt", "1", "for i, ss in enumerate(s[1:], start=1):\n if pre == ss:\n cnt += 1\n else:\n s_sum.append(cnt)\n s_composed.append(pre)\n s_idx.append(i)\n cnt = 1\n pre = ss\n ", "i", "ss", "enumerate(s[1:], start=1)", "enumerate", "s[1:]", "s", "1:", "1", "start=1", "start", "1", "if pre == ss:\n cnt += 1\n else:\n s_sum.append(cnt)\n s_composed.append(pre)\n s_idx.append(i)\n cnt = 1\n pre = ss\n ", "pre == ss", "pre", "ss", "cnt += 1", "cnt", "1", "s_sum.append(cnt)", "s_sum.append", "s_sum", "append", "cnt", "s_composed.append(pre)", "s_composed.append", "s_composed", "append", "pre", "s_idx.append(i)", "s_idx.append", "s_idx", "append", "i", "cnt = 1", "cnt", "1", "pre = ss", "pre", "ss", "s_sum.append(cnt)", "s_sum.append", "s_sum", "append", "cnt", "s_composed.append(pre)", "s_composed.append", "s_composed", "append", "pre", "return s_composed, s_sum, s_idx", "return s_composed, s_sum, s_idx", "s_composed", "s_sum", "s_idx", "s", "s", "S_composed, _, _ = run_length_encoding(input())", "S_composed", "run_length_encoding(input())", "run_length_encoding", "input()", "input", "_", "_", "print(len(S_composed) - 1)", "print", "len(S_composed) - 1", "len(S_composed)", "len", "S_composed", "1", "_, _ = run_length_encoding(input())", "run_length_encoding(input())", "_", "def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n s_composed, s_sum = [], []\n s_idx = [0]\n pre = s[0]\n cnt = 1\n for i, ss in enumerate(s[1:], start=1):\n if pre == ss:\n cnt += 1\n else:\n s_sum.append(cnt)\n s_composed.append(pre)\n s_idx.append(i)\n cnt = 1\n pre = ss\n s_sum.append(cnt)\n s_composed.append(pre)\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx\n\n\n# def run_length_encoding(s):\n# '''連長圧縮を行う\n# s ... iterable object e.g. list, str\n# return\n# ----------\n# s_composed,s_num,s_idx\n# それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n# from itertools import groupby\n# s_composed, s_sum = [], []\n# s_idx = [0]\n# for k, v in groupby(s):\n# s_composed.append(k)\n# n = len(list(v))\n# s_sum.append(n)\n# s_idx.append(s_idx[-1] + n)\n\n# # assert len(s_sum) == len(s_composed)\n# return s_composed, s_sum, s_idx", "def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n s_composed, s_sum = [], []\n s_idx = [0]\n pre = s[0]\n cnt = 1\n for i, ss in enumerate(s[1:], start=1):\n if pre == ss:\n cnt += 1\n else:\n s_sum.append(cnt)\n s_composed.append(pre)\n s_idx.append(i)\n cnt = 1\n pre = ss\n s_sum.append(cnt)\n s_composed.append(pre)\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx\n\n\n# def run_length_encoding(s):\n# '''連長圧縮を行う\n# s ... iterable object e.g. list, str\n# return\n# ----------\n# s_composed,s_num,s_idx\n# それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n# from itertools import groupby\n# s_composed, s_sum = [], []\n# s_idx = [0]\n# for k, v in groupby(s):\n# s_composed.append(k)\n# n = len(list(v))\n# s_sum.append(n)\n# s_idx.append(s_idx[-1] + n)\n\n# # assert len(s_sum) == len(s_composed)\n# return s_composed, s_sum, s_idx", "run_length_encoding", "S_composed, _, _ = run_length_encoding(input())", "run_length_encoding(input())", "S_composed", "_ = run_length_encoding(input())", "run_length_encoding(input())", "_" ]
# https://atcoder.jp/contests/abc047/tasks/arc063_a # 連長圧縮すれば簡単 # 圧縮後の文字列長-1となる def run_length_encoding(s): '''連長圧縮を行う s ... iterable object e.g. list, str return ---------- s_composed,s_num,s_idx それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx''' s_composed, s_sum = [], [] s_idx = [0] pre = s[0] cnt = 1 for i, ss in enumerate(s[1:], start=1): if pre == ss: cnt += 1 else: s_sum.append(cnt) s_composed.append(pre) s_idx.append(i) cnt = 1 pre = ss s_sum.append(cnt) s_composed.append(pre) # assert len(s_sum) == len(s_composed) return s_composed, s_sum, s_idx # def run_length_encoding(s): # '''連長圧縮を行う # s ... iterable object e.g. list, str # return # ---------- # s_composed,s_num,s_idx # それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx''' # from itertools import groupby # s_composed, s_sum = [], [] # s_idx = [0] # for k, v in groupby(s): # s_composed.append(k) # n = len(list(v)) # s_sum.append(n) # s_idx.append(s_idx[-1] + n) # # assert len(s_sum) == len(s_composed) # return s_composed, s_sum, s_idx S_composed, _, _ = run_length_encoding(input()) print(len(S_composed) - 1)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 2, 39, 17, 2, 13, 17, 28, 13, 4, 13, 2, 13, 17, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 18, 13, 2, 13, 17, 17, 4, 13, 4, 13, 13, 10, 2, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 54, 2 ], [ 57, 6 ], [ 55, 9 ], [ 60, 11 ], [ 51, 14 ], [ 58, 19 ], [ 23, 22 ], [ 58, 26 ], [ 55, 31 ], [ 22, 32 ], [ 55, 34 ], [ 22, 36 ], [ 44, 39 ], [ 52, 40 ], [ 22, 42 ], [ 52, 49 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ] ]
[ "s = input()\nn = len(s)\ncount = 0\nsikii = [0]*(n+1)\nfor i in range(n-1):\n if s[i] != s[i+1]:\n sikii[i+1] = 1\n#print(sikii)\nprint(sum(sikii))", "s = input()", "s", "input()", "input", "n = len(s)", "n", "len(s)", "len", "s", "count = 0", "count", "0", "sikii = [0]*(n+1)", "sikii", "[0]*(n+1)", "[0]", "0", "n+1", "n", "1", "for i in range(n-1):\n if s[i] != s[i+1]:\n sikii[i+1] = 1\n#print(sikii)", "i", "range(n-1)", "range", "n-1", "n", "1", "if s[i] != s[i+1]:\n sikii[i+1] = 1\n#print(sikii)", "s[i] != s[i+1]", "s[i]", "s", "i", "s[i+1]", "s", "i+1", "i", "1", "sikii[i+1] = 1", "sikii[i+1]", "sikii", "i+1", "i", "1", "1", "print(sum(sikii))", "print", "sum(sikii)", "sum", "sikii", "sikii = [0]*(n+1)", "[0]*(n+1)", "sikii", "s = input()", "input()", "s", "n = len(s)", "len(s)", "n", "count = 0", "0", "count" ]
s = input() n = len(s) count = 0 sikii = [0]*(n+1) for i in range(n-1): if s[i] != s[i+1]: sikii[i+1] = 1 #print(sikii) print(sum(sikii))
[ 7, 15, 13, 0, 13, 4, 13, 4, 13, 2, 4, 13, 4, 13, 4, 18, 13, 13, 13, 17, 10, 4, 13 ]
[ [ 21, 4 ], [ 22, 18 ], [ 21, 22 ] ]
[ "import itertools\ns = input()\nprint(len(list(itertools.groupby(s)))-1)", "import itertools", "itertools", "s = input()", "s", "input()", "input", "print(len(list(itertools.groupby(s)))-1)", "print", "len(list(itertools.groupby(s)))-1", "len(list(itertools.groupby(s)))", "len", "list(itertools.groupby(s))", "list", "itertools.groupby(s)", "itertools.groupby", "itertools", "groupby", "s", "1", "s = input()", "input()", "s" ]
import itertools s = input() print(len(list(itertools.groupby(s)))-1)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 2, 13, 17, 14, 40, 18, 13, 2, 13, 17, 13, 0, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 18, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 18, 13, 10, 4, 13 ]
[ [ 62, 2 ], [ 53, 6 ], [ 63, 9 ], [ 47, 11 ], [ 63, 13 ], [ 50, 16 ], [ 20, 19 ], [ 54, 23 ], [ 63, 28 ], [ 19, 30 ], [ 48, 32 ], [ 60, 32 ], [ 59, 34 ], [ 63, 36 ], [ 19, 38 ], [ 56, 41 ], [ 57, 45 ], [ 51, 45 ], [ 47, 48 ], [ 50, 51 ], [ 53, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ] ]
[ "S = input()\nN = len(S)\nnow = S[0]\nans = 0\nfor i in range(N-1):\n if S[i+1] != now:\n now = S[i+1]\n ans += 1\nprint(ans)", "S = input()", "S", "input()", "input", "N = len(S)", "N", "len(S)", "len", "S", "now = S[0]", "now", "S[0]", "S", "0", "ans = 0", "ans", "0", "for i in range(N-1):\n if S[i+1] != now:\n now = S[i+1]\n ans += 1", "i", "range(N-1)", "range", "N-1", "N", "1", "if S[i+1] != now:\n now = S[i+1]\n ans += 1", "S[i+1] != now", "S[i+1]", "S", "i+1", "i", "1", "now", "now = S[i+1]", "now", "S[i+1]", "S", "i+1", "i", "1", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "now = S[0]", "S[0]", "now", "ans = 0", "0", "ans", "N = len(S)", "len(S)", "N", "ans += 1", "1", "ans", "now = S[i+1]", "S[i+1]", "now", "S = input()", "input()", "S" ]
S = input() N = len(S) now = S[0] ans = 0 for i in range(N-1): if S[i+1] != now: now = S[i+1] ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 18, 13, 39, 17, 14, 2, 13, 13, 9, 0, 13, 13, 0, 13, 17, 4, 13, 13, 10, 13, 13, 10, 18, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 46, 2 ], [ 37, 6 ], [ 47, 8 ], [ 43, 11 ], [ 15, 14 ], [ 47, 16 ], [ 14, 21 ], [ 38, 22 ], [ 35, 22 ], [ 34, 25 ], [ 14, 26 ], [ 40, 28 ], [ 41, 32 ], [ 44, 32 ], [ 14, 34 ], [ 34, 35 ], [ 37, 38 ], [ 40, 41 ], [ 43, 44 ], [ 46, 47 ] ]
[ "S = input()\nprev = S[0]\ncnt = 0\nfor c in S[1:]:\n if c == prev:\n continue\n prev = c\n cnt += 1\nprint(cnt)", "S = input()", "S", "input()", "input", "prev = S[0]", "prev", "S[0]", "S", "0", "cnt = 0", "cnt", "0", "for c in S[1:]:\n if c == prev:\n continue\n prev = c\n cnt += 1", "c", "S[1:]", "S", "1:", "1", "if c == prev:\n continue\n ", "c == prev", "c", "prev", "continue", "prev = c", "prev", "c", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "prev = c", "c", "prev", "prev = S[0]", "S[0]", "prev", "cnt += 1", "1", "cnt", "cnt = 0", "0", "cnt", "S = input()", "input()", "S" ]
S = input() prev = S[0] cnt = 0 for c in S[1:]: if c == prev: continue prev = c cnt += 1 print(cnt)
[ 7, 15, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 4, 13, 17, 0, 13, 2, 2, 17, 17, 17, 12, 13, 0, 13, 4, 18, 4, 18, 4, 13, 13, 17, 13, 0, 13, 17, 0, 13, 4, 13, 13, 28, 13, 4, 13, 17, 13, 14, 40, 18, 13, 2, 13, 17, 18, 13, 13, 0, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 2, 13, 10, 4, 13, 10, 12, 13, 10, 18, 13 ]
[ [ 90, 4 ], [ 84, 20 ], [ 81, 25 ], [ 35, 34 ], [ 91, 40 ], [ 46, 45 ], [ 49, 48 ], [ 34, 51 ], [ 54, 53 ], [ 48, 57 ], [ 34, 61 ], [ 53, 63 ], [ 34, 66 ], [ 53, 67 ], [ 70, 69 ], [ 69, 73 ], [ 45, 73 ], [ 88, 79 ], [ 81, 82 ], [ 84, 85 ], [ 90, 91 ] ]
[ "import sys\nreadline = sys.stdin.buffer.readline\nsys.setrecursionlimit(10 ** 8)\nINF = float('inf')\nMOD = 10 ** 9 + 7\n\ndef main():\n S = readline().decode('utf-8').strip()\n change = 0\n L = len(S)\n for i in range(1,L):\n if S[i-1]!=S[i]:\n change += 1\n print(change)\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "readline = sys.stdin.buffer.readline", "readline", "sys.stdin.buffer.readline", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readline", "sys.setrecursionlimit(10 ** 8)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 8", "10", "8", "INF = float('inf')", "INF", "float('inf')", "float", "'inf'", "MOD = 10 ** 9 + 7", "MOD", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "def main():\n S = readline().decode('utf-8').strip()\n change = 0\n L = len(S)\n for i in range(1,L):\n if S[i-1]!=S[i]:\n change += 1\n print(change)", "main", "S = readline().decode('utf-8').strip()", "S", "readline().decode('utf-8').strip()", "().decode('utf-8').strip", "().decode('utf-8')", "().decode", "()", "readline", "decode", "'utf-8'", "strip", "change = 0", "change", "0", "L = len(S)", "L", "len(S)", "len", "S", "for i in range(1,L):\n if S[i-1]!=S[i]:\n change += 1\n ", "i", "range(1,L)", "range", "1", "L", "if S[i-1]!=S[i]:\n change += 1\n ", "S[i-1]!=S[i]", "S[i-1]", "S", "i-1", "i", "1", "S[i]", "S", "i", "change += 1", "change", "1", "print(change)", "print", "change", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "MOD = 10 ** 9 + 7", "10 ** 9 + 7", "MOD", "INF = float('inf')", "float('inf')", "INF", "def main():\n S = readline().decode('utf-8').strip()\n change = 0\n L = len(S)\n for i in range(1,L):\n if S[i-1]!=S[i]:\n change += 1\n print(change)", "def main():\n S = readline().decode('utf-8').strip()\n change = 0\n L = len(S)\n for i in range(1,L):\n if S[i-1]!=S[i]:\n change += 1\n print(change)", "main", "readline = sys.stdin.buffer.readline", "sys.stdin.buffer.readline", "readline" ]
import sys readline = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 8) INF = float('inf') MOD = 10 ** 9 + 7 def main(): S = readline().decode('utf-8').strip() change = 0 L = len(S) for i in range(1,L): if S[i-1]!=S[i]: change += 1 print(change) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 41, 28, 13, 4, 13, 2, 4, 13, 13, 17, 4, 8, 40, 18, 13, 13, 18, 13, 2, 13, 17, 17, 17, 4, 13, 4, 13, 13, 10, 4, 13 ]
[ [ 34, 2 ], [ 8, 7 ], [ 35, 13 ], [ 35, 19 ], [ 7, 20 ], [ 35, 22 ], [ 7, 24 ], [ 34, 35 ] ]
[ "S=input()\nprint(sum([1 if S[i]!=S[i+1]else 0 for i in range(len(S)-1)]))", "S=input()", "S", "input()", "input", "1 if S[i]!=S[i+1]else 0 for i in range(len(S)-1)", "for i in range(len(S)-1)", "i", "range(len(S)-1)", "range", "len(S)-1", "len(S)", "len", "S", "1", "for i in range(len(S)-1)", "1 if S[i]!=S[i+1]else 0", "S[i]!=S[i+1]", "S[i]", "S", "i", "S[i+1]", "S", "i+1", "i", "1", "1", "0", "print(sum([1 if S[i]!=S[i+1]else 0 for i in range(len(S)-1)]))", "print", "sum([1 if S[i]!=S[i+1]else 0 for i in range(len(S)-1)])", "sum", "[1 if S[i]!=S[i+1]else 0 for i in range(len(S)-1)]", "S=input()", "input()", "S" ]
S=input() print(sum([1 if S[i]!=S[i+1]else 0 for i in range(len(S)-1)]))
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 41, 2 ], [ 35, 8 ], [ 12, 11 ], [ 42, 17 ], [ 42, 21 ], [ 11, 22 ], [ 42, 24 ], [ 11, 26 ], [ 38, 29 ], [ 39, 33 ], [ 36, 33 ], [ 35, 36 ], [ 38, 39 ], [ 41, 42 ] ]
[ "s = list(input())\nans = 0\nfor i in range(1, len(s)):\n if s[i] != s[i-1]:\n ans += 1\nprint(ans)", "s = list(input())", "s", "list(input())", "list", "input()", "input", "ans = 0", "ans", "0", "for i in range(1, len(s)):\n if s[i] != s[i-1]:\n ans += 1", "i", "range(1, len(s))", "range", "1", "len(s)", "len", "s", "if s[i] != s[i-1]:\n ans += 1", "s[i] != s[i-1]", "s[i]", "s", "i", "s[i-1]", "s", "i-1", "i", "1", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "ans = 0", "0", "ans", "ans += 1", "1", "ans", "s = list(input())", "list(input())", "s" ]
s = list(input()) ans = 0 for i in range(1, len(s)): if s[i] != s[i-1]: ans += 1 print(ans)
[ 7, 15, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 12, 4, 18, 4, 18, 18, 13, 13, 13, 13, 0, 13, 12, 4, 13, 8, 13, 39, 4, 13, 17, 4, 13, 17, 23, 0, 13, 12, 4, 13, 8, 13, 39, 4, 13, 17, 4, 13, 17, 23, 0, 13, 12, 2, 4, 13, 13, 17, 23, 12, 13, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 2, 4, 13, 13, 17, 0, 13, 40, 18, 13, 2, 13, 17, 18, 13, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 2, 13, 10, 12, 13, 10, 2, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 124, 11 ], [ 118, 16 ], [ 127, 23 ], [ 112, 35 ], [ 121, 50 ], [ 115, 65 ], [ 77, 76 ], [ 128, 78 ], [ 81, 80 ], [ 84, 83 ], [ 76, 89 ], [ 93, 92 ], [ 76, 95 ], [ 83, 97 ], [ 76, 100 ], [ 83, 101 ], [ 92, 104 ], [ 80, 104 ], [ 131, 110 ], [ 112, 113 ], [ 115, 116 ], [ 118, 119 ], [ 121, 122 ], [ 124, 125 ], [ 127, 128 ] ]
[ "# -*- coding: utf-8 -*-\nimport sys\nsys.setrecursionlimit(10**9)\nINF=10**18\nMOD=10**9+7\ninput=lambda: sys.stdin.readline().rstrip()\nYesNo=lambda b: bool([print('Yes')] if b else print('No'))\nYESNO=lambda b: bool([print('YES')] if b else print('NO'))\nint1=lambda x:int(x)-1\n\ndef main():\n S=input()\n tmp=0\n for i in range(len(S)-1):\n tmp+=(S[i+1]!=S[i])\n print(tmp)\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "sys.setrecursionlimit(10**9)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**9", "10", "9", "INF=10**18", "INF", "10**18", "10", "18", "MOD=10**9+7", "MOD", "10**9+7", "10**9", "10", "9", "7", "input=lambda: sys.stdin.readline().rstrip()", "input", "lambda: sys.stdin.readline().rstrip()", "sys.stdin.readline().rstrip()", "sys.stdin.readline().rstrip", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "rstrip", "YesNo=lambda b: bool([print('Yes')] if b else print('No'))", "YesNo", "lambda b: bool([print('Yes')] if b else print('No'))", "bool([print('Yes')] if b else print('No'))", "bool", "[print('Yes')] if b else print('No')", "b", "[print('Yes')]", "print('Yes')", "print", "'Yes'", "print('No')", "print", "'No'", "b", "YESNO=lambda b: bool([print('YES')] if b else print('NO'))", "YESNO", "lambda b: bool([print('YES')] if b else print('NO'))", "bool([print('YES')] if b else print('NO'))", "bool", "[print('YES')] if b else print('NO')", "b", "[print('YES')]", "print('YES')", "print", "'YES'", "print('NO')", "print", "'NO'", "b", "int1=lambda x:int(x)-1", "int1", "lambda x:int(x)-1", "int(x)-1", "int(x)", "int", "x", "1", "x", "def main():\n S=input()\n tmp=0\n for i in range(len(S)-1):\n tmp+=(S[i+1]!=S[i])\n print(tmp)", "main", "S=input()", "S", "input()", "input", "tmp=0", "tmp", "0", "for i in range(len(S)-1):\n tmp+=(S[i+1]!=S[i])\n ", "i", "range(len(S)-1)", "range", "len(S)-1", "len(S)", "len", "S", "1", "tmp+=(S[i+1]!=S[i])", "tmp", "S[i+1]!=S[i]", "S[i+1]", "S", "i+1", "i", "1", "S[i]", "S", "i", "print(tmp)", "print", "tmp", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "YesNo=lambda b: bool([print('Yes')] if b else print('No'))", "lambda b: bool([print('Yes')] if b else print('No'))", "YesNo", "int1=lambda x:int(x)-1", "lambda x:int(x)-1", "int1", "MOD=10**9+7", "10**9+7", "MOD", "YESNO=lambda b: bool([print('YES')] if b else print('NO'))", "lambda b: bool([print('YES')] if b else print('NO'))", "YESNO", "INF=10**18", "10**18", "INF", "input=lambda: sys.stdin.readline().rstrip()", "lambda: sys.stdin.readline().rstrip()", "input", "def main():\n S=input()\n tmp=0\n for i in range(len(S)-1):\n tmp+=(S[i+1]!=S[i])\n print(tmp)", "def main():\n S=input()\n tmp=0\n for i in range(len(S)-1):\n tmp+=(S[i+1]!=S[i])\n print(tmp)", "main" ]
# -*- coding: utf-8 -*- import sys sys.setrecursionlimit(10**9) INF=10**18 MOD=10**9+7 input=lambda: sys.stdin.readline().rstrip() YesNo=lambda b: bool([print('Yes')] if b else print('No')) YESNO=lambda b: bool([print('YES')] if b else print('NO')) int1=lambda x:int(x)-1 def main(): S=input() tmp=0 for i in range(len(S)-1): tmp+=(S[i+1]!=S[i]) print(tmp) if __name__ == '__main__': main()
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 13, 18, 13, 13, 0, 13, 18, 13, 13, 0, 13, 17, 4, 13, 2, 13, 17, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 4, 10 ], [ 14, 13 ], [ 17, 16 ], [ 4, 22 ], [ 8, 25 ], [ 30, 25 ], [ 4, 27 ], [ 16, 28 ], [ 31, 30 ], [ 4, 32 ], [ 16, 33 ], [ 36, 35 ], [ 35, 40 ], [ 13, 40 ], [ 50, 47 ] ]
[ "# C - 一次元リバーシ\ndef main():\n s = input()\n t = s[0]\n cnt = 1\n\n for i in range(1, len(s)):\n if t != s[i]:\n t = s[i]\n cnt += 1\n else:\n print(cnt-1)\n \n\nif __name__ == \"__main__\":\n main()", "def main():\n s = input()\n t = s[0]\n cnt = 1\n\n for i in range(1, len(s)):\n if t != s[i]:\n t = s[i]\n cnt += 1\n else:\n print(cnt-1)\n ", "main", "s = input()", "s", "input()", "input", "t = s[0]", "t", "s[0]", "s", "0", "cnt = 1", "cnt", "1", "for i in range(1, len(s)):\n if t != s[i]:\n t = s[i]\n cnt += 1\n else:\n print(cnt-1)\n ", "i", "range(1, len(s))", "range", "1", "len(s)", "len", "s", "if t != s[i]:\n t = s[i]\n cnt += 1\n ", "t != s[i]", "t", "s[i]", "s", "i", "t = s[i]", "t", "s[i]", "s", "i", "cnt += 1", "cnt", "1", "print(cnt-1)", "print", "cnt-1", "cnt", "1", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def main():\n s = input()\n t = s[0]\n cnt = 1\n\n for i in range(1, len(s)):\n if t != s[i]:\n t = s[i]\n cnt += 1\n else:\n print(cnt-1)\n ", "def main():\n s = input()\n t = s[0]\n cnt = 1\n\n for i in range(1, len(s)):\n if t != s[i]:\n t = s[i]\n cnt += 1\n else:\n print(cnt-1)\n ", "main" ]
# C - 一次元リバーシ def main(): s = input() t = s[0] cnt = 1 for i in range(1, len(s)): if t != s[i]: t = s[i] cnt += 1 else: print(cnt-1) if __name__ == "__main__": main()
[ 7, 15, 13, 0, 13, 4, 13, 0, 13, 4, 18, 13, 13, 13, 4, 13, 2, 4, 13, 4, 13, 13, 17, 10, 4, 13, 10, 4, 13 ]
[ [ 24, 4 ], [ 27, 8 ], [ 25, 13 ], [ 28, 21 ], [ 24, 25 ], [ 27, 28 ] ]
[ "import itertools\nS = input()\nG = itertools.groupby(S)\nprint(len(list(G))-1)", "import itertools", "itertools", "S = input()", "S", "input()", "input", "G = itertools.groupby(S)", "G", "itertools.groupby(S)", "itertools.groupby", "itertools", "groupby", "S", "print(len(list(G))-1)", "print", "len(list(G))-1", "len(list(G))", "len", "list(G)", "list", "G", "1", "S = input()", "input()", "S", "G = itertools.groupby(S)", "itertools.groupby(S)", "G" ]
import itertools S = input() G = itertools.groupby(S) print(len(list(G))-1)
[ 7, 15, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 18, 18, 18, 13, 13, 13, 13, 0, 13, 4, 18, 4, 18, 4, 13, 13, 13, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 2, 13, 17, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 18, 13, 10, 18, 13, 10, 18, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 77, 4 ], [ 71, 13 ], [ 74, 22 ], [ 83, 31 ], [ 72, 37 ], [ 68, 41 ], [ 45, 44 ], [ 84, 50 ], [ 84, 54 ], [ 44, 56 ], [ 84, 59 ], [ 44, 60 ], [ 80, 62 ], [ 81, 66 ], [ 69, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ], [ 83, 84 ] ]
[ "import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\ns = readline().decode().rstrip()\ncnt = 0\nfor i in range(1, len(s)):\n if s[i - 1] != s[i]:\n cnt += 1\nprint(cnt)", "import sys", "sys", "read = sys.stdin.buffer.read", "read", "sys.stdin.buffer.read", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "read", "readline = sys.stdin.buffer.readline", "readline", "sys.stdin.buffer.readline", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readline", "readlines = sys.stdin.buffer.readlines", "readlines", "sys.stdin.buffer.readlines", "sys.stdin.buffer", "sys.stdin", "sys", "stdin", "buffer", "readlines", "s = readline().decode().rstrip()", "s", "readline().decode().rstrip()", "().decode().rstrip", "().decode()", "().decode", "()", "readline", "decode", "rstrip", "cnt = 0", "cnt", "0", "for i in range(1, len(s)):\n if s[i - 1] != s[i]:\n cnt += 1", "i", "range(1, len(s))", "range", "1", "len(s)", "len", "s", "if s[i - 1] != s[i]:\n cnt += 1", "s[i - 1] != s[i]", "s[i - 1]", "s", "i - 1", "i", "1", "s[i]", "s", "i", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "cnt = 0", "0", "cnt", "readline = sys.stdin.buffer.readline", "sys.stdin.buffer.readline", "readline", "readlines = sys.stdin.buffer.readlines", "sys.stdin.buffer.readlines", "readlines", "read = sys.stdin.buffer.read", "sys.stdin.buffer.read", "read", "cnt += 1", "1", "cnt", "s = readline().decode().rstrip()", "readline().decode().rstrip()", "s" ]
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines s = readline().decode().rstrip() cnt = 0 for i in range(1, len(s)): if s[i - 1] != s[i]: cnt += 1 print(cnt)
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 13, 10, 18, 13, 10, 4, 13, 10, 17, 13, 10, 18, 13, 10, 17, 13 ]
[ [ 42, 2 ], [ 48, 6 ], [ 43, 8 ], [ 45, 11 ], [ 15, 14 ], [ 43, 20 ], [ 43, 24 ], [ 14, 25 ], [ 49, 26 ], [ 40, 26 ], [ 51, 28 ], [ 39, 31 ], [ 43, 33 ], [ 14, 34 ], [ 52, 37 ], [ 46, 37 ], [ 39, 40 ], [ 42, 43 ], [ 45, 46 ], [ 48, 49 ], [ 51, 52 ] ]
[ "S=input()\nrest=S[0]\ncnt=0\nfor i in range(1,len(S)):\n if S[i]!=rest:\n cnt+=1\n rest=S[i]\nprint(cnt)", "S=input()", "S", "input()", "input", "rest=S[0]", "rest", "S[0]", "S", "0", "cnt=0", "cnt", "0", "for i in range(1,len(S)):\n if S[i]!=rest:\n cnt+=1\n rest=S[i]", "i", "range(1,len(S))", "range", "1", "len(S)", "len", "S", "if S[i]!=rest:\n cnt+=1\n rest=S[i]", "S[i]!=rest", "S[i]", "S", "i", "rest", "cnt+=1", "cnt", "1", "rest=S[i]", "rest", "S[i]", "S", "i", "print(cnt)", "print", "cnt", "rest=S[i]", "S[i]", "rest", "S=input()", "input()", "S", "cnt=0", "0", "cnt", "rest=S[0]", "S[0]", "rest", "cnt+=1", "1", "cnt" ]
S=input() rest=S[0] cnt=0 for i in range(1,len(S)): if S[i]!=rest: cnt+=1 rest=S[i] print(cnt)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 39, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 18, 13, 13, 13, 0, 13, 17, 4, 18, 13, 13, 13, 4, 13, 2, 4, 13, 13, 17, 10, 17, 13, 10, 18, 13, 10, 17, 13, 10, 18, 13, 10, 39, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 78, 2 ], [ 69, 8 ], [ 79, 10 ], [ 72, 13 ], [ 75, 16 ], [ 20, 19 ], [ 79, 24 ], [ 79, 28 ], [ 19, 29 ], [ 70, 30 ], [ 64, 30 ], [ 60, 32 ], [ 63, 35 ], [ 79, 37 ], [ 19, 38 ], [ 73, 41 ], [ 76, 43 ], [ 67, 43 ], [ 61, 43 ], [ 66, 45 ], [ 73, 49 ], [ 67, 51 ], [ 61, 51 ], [ 76, 51 ], [ 73, 57 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ] ]
[ "s = str(input())\ntemp = s[0]\nX = []\ncnt = 0\nfor i in range(len(s)):\n if s[i] == temp:\n cnt += 1\n else:\n temp = s[i]\n X.append(cnt)\n cnt = 1\nelse:\n X.append(cnt)\nprint(len(X)-1)", "s = str(input())", "s", "str(input())", "str", "input()", "input", "temp = s[0]", "temp", "s[0]", "s", "0", "X = []", "X", "[]", "cnt = 0", "cnt", "0", "for i in range(len(s)):\n if s[i] == temp:\n cnt += 1\n else:\n temp = s[i]\n X.append(cnt)\n cnt = 1\nelse:\n X.append(cnt)", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i] == temp:\n cnt += 1\n else:\n temp = s[i]\n X.append(cnt)\n cnt = 1", "s[i] == temp", "s[i]", "s", "i", "temp", "cnt += 1", "cnt", "1", "temp = s[i]", "temp", "s[i]", "s", "i", "X.append(cnt)", "X.append", "X", "append", "cnt", "cnt = 1", "cnt", "1", "X.append(cnt)", "X.append", "X", "append", "cnt", "print(len(X)-1)", "print", "len(X)-1", "len(X)", "len", "X", "1", "cnt += 1", "1", "cnt", "temp = s[i]", "s[i]", "temp", "cnt = 1", "1", "cnt", "temp = s[0]", "s[0]", "temp", "X = []", "[]", "X", "cnt = 0", "0", "cnt", "s = str(input())", "str(input())", "s" ]
s = str(input()) temp = s[0] X = [] cnt = 0 for i in range(len(s)): if s[i] == temp: cnt += 1 else: temp = s[i] X.append(cnt) cnt = 1 else: X.append(cnt) print(len(X)-1)
[ 7, 0, 13, 4, 18, 4, 13, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 2, 18, 13, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 18, 13, 10, 18, 13, 10, 17, 13 ]
[ [ 42, 2 ], [ 51, 9 ], [ 43, 11 ], [ 45, 14 ], [ 18, 17 ], [ 43, 23 ], [ 43, 27 ], [ 17, 28 ], [ 52, 29 ], [ 49, 29 ], [ 54, 31 ], [ 48, 34 ], [ 43, 36 ], [ 17, 37 ], [ 55, 40 ], [ 46, 40 ], [ 42, 43 ], [ 45, 46 ], [ 48, 49 ], [ 51, 52 ], [ 54, 55 ] ]
[ "S = input().strip()\ncur = S[0]\ncnt = 0\nfor i in range(1,len(S)):\n if S[i]==cur:continue\n else:\n cnt += 1\n cur = S[i]\nprint(cnt)", "S = input().strip()", "S", "input().strip()", "().strip", "()", "input", "strip", "cur = S[0]", "cur", "S[0]", "S", "0", "cnt = 0", "cnt", "0", "for i in range(1,len(S)):\n if S[i]==cur:continue\n else:\n cnt += 1\n cur = S[i]", "i", "range(1,len(S))", "range", "1", "len(S)", "len", "S", "if S[i]==cur:continue\n else:\n cnt += 1\n cur = S[i]", "S[i]==cur", "S[i]", "S", "i", "cur", "cnt += 1", "cnt", "1", "cur = S[i]", "cur", "S[i]", "S", "i", "print(cnt)", "print", "cnt", "S = input().strip()", "input().strip()", "S", "cnt = 0", "0", "cnt", "cur = S[i]", "S[i]", "cur", "cur = S[0]", "S[0]", "cur", "cnt += 1", "1", "cnt" ]
S = input().strip() cur = S[0] cnt = 0 for i in range(1,len(S)): if S[i]==cur:continue else: cnt += 1 cur = S[i] print(cnt)
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 40, 13, 17, 2, 13, 13, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 12, 11 ], [ 15, 14 ], [ 4, 14 ], [ 8, 19 ], [ 35, 19 ], [ 32, 19 ], [ 8, 22 ], [ 35, 22 ], [ 32, 22 ], [ 14, 23 ], [ 26, 25 ], [ 14, 29 ], [ 33, 32 ], [ 36, 35 ], [ 25, 39 ], [ 11, 39 ], [ 48, 45 ] ]
[ "def main():\n ss = input()\n put_stone = ''\n count = 0\n for stone in ss:\n if put_stone != '' and put_stone == stone:\n count += 1\n if stone == 'B':\n put_stone = 'W'\n else:\n put_stone = 'B'\n print(count)\n\nif __name__ == '__main__':\n main()", "def main():\n ss = input()\n put_stone = ''\n count = 0\n for stone in ss:\n if put_stone != '' and put_stone == stone:\n count += 1\n if stone == 'B':\n put_stone = 'W'\n else:\n put_stone = 'B'\n print(count)", "main", "ss = input()", "ss", "input()", "input", "put_stone = ''", "put_stone", "''", "count = 0", "count", "0", "for stone in ss:\n if put_stone != '' and put_stone == stone:\n count += 1\n if stone == 'B':\n put_stone = 'W'\n else:\n put_stone = 'B'\n ", "stone", "ss", "if put_stone != '' and put_stone == stone:\n count += 1\n ", "put_stone != '' and put_stone == stone", "put_stone != ''", "put_stone", "''", "put_stone == stone", "put_stone", "stone", "count += 1", "count", "1", "if stone == 'B':\n put_stone = 'W'\n else:\n put_stone = 'B'\n ", "stone == 'B'", "stone", "'B'", "put_stone = 'W'", "put_stone", "'W'", "put_stone = 'B'", "put_stone", "'B'", "print(count)", "print", "count", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n ss = input()\n put_stone = ''\n count = 0\n for stone in ss:\n if put_stone != '' and put_stone == stone:\n count += 1\n if stone == 'B':\n put_stone = 'W'\n else:\n put_stone = 'B'\n print(count)", "def main():\n ss = input()\n put_stone = ''\n count = 0\n for stone in ss:\n if put_stone != '' and put_stone == stone:\n count += 1\n if stone == 'B':\n put_stone = 'W'\n else:\n put_stone = 'B'\n print(count)", "main" ]
def main(): ss = input() put_stone = '' count = 0 for stone in ss: if put_stone != '' and put_stone == stone: count += 1 if stone == 'B': put_stone = 'W' else: put_stone = 'B' print(count) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 13, 18, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 13, 10, 18, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 18, 13 ]
[ [ 48, 2 ], [ 51, 6 ], [ 49, 8 ], [ 45, 11 ], [ 15, 14 ], [ 49, 20 ], [ 52, 23 ], [ 40, 23 ], [ 49, 25 ], [ 14, 26 ], [ 42, 28 ], [ 39, 31 ], [ 49, 33 ], [ 14, 34 ], [ 43, 37 ], [ 46, 37 ], [ 39, 40 ], [ 42, 43 ], [ 45, 46 ], [ 48, 49 ], [ 51, 52 ] ]
[ "#import\n#import math\n#import numpy as np\n#= int(input())\nS = input()\n#= map(int, input().split())\n#= list(map(int, input().split()))\n#= [input(), input()]\n#= [list(map(int, input().split())) for _ in range(N)]\n#= {i:[] for i in range(N)}\n\ns = S[0]\n\nr = 0\n\nfor i in range(1, len(S)):\n if s != S[i]:\n r += 1\n\n s = S[i]\n\nprint(r)", "S = input()", "S", "input()", "input", "s = S[0]", "s", "S[0]", "S", "0", "r = 0", "r", "0", "for i in range(1, len(S)):\n if s != S[i]:\n r += 1\n\n s = S[i]", "i", "range(1, len(S))", "range", "1", "len(S)", "len", "S", "if s != S[i]:\n r += 1\n\n ", "s != S[i]", "s", "S[i]", "S", "i", "r += 1", "r", "1", "s = S[i]", "s", "S[i]", "S", "i", "print(r)", "print", "r", "s = S[i]", "S[i]", "s", "r += 1", "1", "r", "r = 0", "0", "r", "S = input()", "input()", "S", "s = S[0]", "S[0]", "s" ]
#import #import math #import numpy as np #= int(input()) S = input() #= map(int, input().split()) #= list(map(int, input().split())) #= [input(), input()] #= [list(map(int, input().split())) for _ in range(N)] #= {i:[] for i in range(N)} s = S[0] r = 0 for i in range(1, len(S)): if s != S[i]: r += 1 s = S[i] print(r)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 13, 17, 9, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 40, 2 ], [ 37, 6 ], [ 10, 9 ], [ 41, 14 ], [ 9, 17 ], [ 41, 23 ], [ 9, 24 ], [ 41, 26 ], [ 9, 28 ], [ 43, 31 ], [ 44, 35 ], [ 38, 35 ], [ 37, 38 ], [ 40, 41 ], [ 43, 44 ] ]
[ "a = input()\ncnt = 0\nfor i in range(len(a)):\n if i == 0:\n continue\n if a[i] != a[i-1]:\n cnt += 1\nprint(cnt)", "a = input()", "a", "input()", "input", "cnt = 0", "cnt", "0", "for i in range(len(a)):\n if i == 0:\n continue\n if a[i] != a[i-1]:\n cnt += 1", "i", "range(len(a))", "range", "len(a)", "len", "a", "if i == 0:\n continue\n ", "i == 0", "i", "0", "continue", "if a[i] != a[i-1]:\n cnt += 1", "a[i] != a[i-1]", "a[i]", "a", "i", "a[i-1]", "a", "i-1", "i", "1", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "cnt = 0", "0", "cnt", "a = input()", "input()", "a", "cnt += 1", "1", "cnt" ]
a = input() cnt = 0 for i in range(len(a)): if i == 0: continue if a[i] != a[i-1]: cnt += 1 print(cnt)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 39, 17, 17, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 4, 13, 13, 14, 2, 18, 13, 13, 17, 0, 18, 13, 17, 17, 0, 18, 13, 17, 17, 14, 40, 13, 17, 14, 2, 18, 13, 13, 13, 9, 0, 13, 17, 0, 13, 18, 13, 13, 14, 2, 18, 13, 17, 17, 4, 13, 17, 4, 13, 14, 2, 18, 13, 17, 17, 4, 13, 17, 4, 13, 4, 13, 13, 10, 18, 13, 10, 39, 13, 10, 4, 13, 10, 4, 13, 10, 18, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 97, 2 ], [ 100, 8 ], [ 98, 11 ], [ 94, 13 ], [ 109, 18 ], [ 103, 21 ], [ 98, 23 ], [ 27, 26 ], [ 101, 29 ], [ 98, 33 ], [ 26, 34 ], [ 40, 37 ], [ 95, 38 ], [ 45, 42 ], [ 95, 43 ], [ 26, 48 ], [ 98, 53 ], [ 26, 54 ], [ 104, 55 ], [ 92, 55 ], [ 106, 58 ], [ 91, 61 ], [ 98, 63 ], [ 26, 64 ], [ 95, 68 ], [ 95, 79 ], [ 107, 89 ], [ 110, 89 ], [ 91, 92 ], [ 94, 95 ], [ 97, 98 ], [ 100, 101 ], [ 103, 104 ], [ 106, 107 ], [ 109, 110 ] ]
[ "S = str(input())\nN = len(S)\nD = [0,0] #B,W\nans = 0; prev = S[0]\nfor i in range(N):\n if S[i] == \"B\":\n D[0] += 1\n else:\n D[1] += 1\n if i >= 1:\n if S[i] == prev:\n continue\n else:\n ans += 1\n prev = S[i]\nif D[0] == 0: #すべてW\n print(0); exit()\nelif D[1] == 0:\n print(0); exit()\nprint(ans)", "S = str(input())", "S", "str(input())", "str", "input()", "input", "N = len(S)", "N", "len(S)", "len", "S", "D = [0,0]", "D", "[0,0]", "0", "0", "ans = 0", "ans", "0", "prev = S[0]", "prev", "S[0]", "S", "0", "for i in range(N):\n if S[i] == \"B\":\n D[0] += 1\n else:\n D[1] += 1\n if i >= 1:\n if S[i] == prev:\n continue\n else:\n ans += 1\n prev = S[i]", "i", "range(N)", "range", "N", "if S[i] == \"B\":\n D[0] += 1\n else:\n D[1] += 1\n ", "S[i] == \"B\"", "S[i]", "S", "i", "\"B\"", "D[0] += 1", "D[0]", "D", "0", "1", "D[1] += 1", "D[1]", "D", "1", "1", "if i >= 1:\n if S[i] == prev:\n continue\n else:\n ans += 1\n prev = S[i]", "i >= 1", "i", "1", "if S[i] == prev:\n continue\n else:\n ans += 1\n prev = S[i]", "S[i] == prev", "S[i]", "S", "i", "prev", "continue", "ans += 1", "ans", "1", "prev = S[i]", "prev", "S[i]", "S", "i", "if D[0] == 0: #すべてW\n print(0); exit()\nelif D[1] == 0:\n print(0); exit()", "D[0] == 0", "D[0]", "D", "0", "0", "print(0)", "print", "0", "exit()", "exit", "elif D[1] == 0:\n print(0); exit()", "D[1] == 0", "D[1]", "D", "1", "0", "print(0)", "print", "0", "exit()", "exit", "print(ans)", "print", "ans", "prev = S[i]", "S[i]", "prev", "D = [0,0]", "[0,0]", "D", "S = str(input())", "str(input())", "S", "N = len(S)", "len(S)", "N", "prev = S[0]", "S[0]", "prev", "ans += 1", "1", "ans", "ans = 0", "0", "ans" ]
S = str(input()) N = len(S) D = [0,0] #B,W ans = 0; prev = S[0] for i in range(N): if S[i] == "B": D[0] += 1 else: D[1] += 1 if i >= 1: if S[i] == prev: continue else: ans += 1 prev = S[i] if D[0] == 0: #すべてW print(0); exit() elif D[1] == 0: print(0); exit() print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 13, 17, 28, 13, 13, 14, 40, 13, 13, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 0, 13, 13, 14, 2, 2, 13, 17, 2, 13, 17, 4, 13, 17, 14, 2, 13, 13, 4, 13, 2, 2, 13, 17, 17, 0, 13, 4, 13, 13, 13, 13, 4, 13, 13, 13, 4, 13, 2, 13, 17, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 84, 2 ], [ 96, 6 ], [ 72, 9 ], [ 78, 11 ], [ 15, 14 ], [ 85, 14 ], [ 14, 18 ], [ 97, 19 ], [ 88, 19 ], [ 14, 22 ], [ 81, 25 ], [ 93, 28 ], [ 87, 31 ], [ 14, 32 ], [ 82, 36 ], [ 73, 36 ], [ 94, 39 ], [ 79, 39 ], [ 82, 46 ], [ 73, 46 ], [ 94, 47 ], [ 79, 47 ], [ 82, 52 ], [ 73, 52 ], [ 90, 56 ], [ 82, 59 ], [ 73, 59 ], [ 94, 60 ], [ 79, 60 ], [ 75, 61 ], [ 82, 64 ], [ 73, 64 ], [ 94, 65 ], [ 79, 65 ], [ 91, 69 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 14, 87 ], [ 87, 88 ], [ 90, 91 ], [ 93, 94 ], [ 96, 97 ] ]
[ "S = input()\npre = \"X\"\nB, W = 0, 0\nfor s in S:\n if s != pre:\n if s == \"B\":\n B += 1\n else:\n W += 1\n pre = s\n\nif B == 0 or W == 0:\n print(0)\nelif B == W:\n print(B * 2 - 1)\nelse:\n x, y = min(B, W), max(B, W)\n print(x * 2)", "S = input()", "S", "input()", "input", "pre = \"X\"", "pre", "\"X\"", "B, W = 0, 0", "B", "0", "W", "0", "for s in S:\n if s != pre:\n if s == \"B\":\n B += 1\n else:\n W += 1\n pre = s", "s", "S", "if s != pre:\n if s == \"B\":\n B += 1\n else:\n W += 1\n pre = s", "s != pre", "s", "pre", "if s == \"B\":\n B += 1\n else:\n W += 1\n ", "s == \"B\"", "s", "\"B\"", "B += 1", "B", "1", "W += 1", "W", "1", "pre = s", "pre", "s", "if B == 0 or W == 0:\n print(0)\nelif B == W:\n print(B * 2 - 1)\nelse:\n x, y = min(B, W), max(B, W)\n print(x * 2)", "B == 0 or W == 0", "B == 0", "B", "0", "W == 0", "W", "0", "print(0)", "print", "0", "elif B == W:\n print(B * 2 - 1)", "B == W", "B", "W", "print(B * 2 - 1)", "print", "B * 2 - 1", "B * 2", "B", "2", "1", "x, y = min(B, W), max(B, W)", "x", "min(B, W)", "min", "B", "W", "y", "max(B, W)", "max", "B", "W", "print(x * 2)", "print", "x * 2", "x", "2", "B, W = 0, 0", "0", "B", "y = min(B, W), max(B, W)", "max(B, W)", "y", "W = 0, 0", "0", "W", "B += 1", "1", "B", "S = input()", "input()", "S", "pre = s", "s", "pre", "x, y = min(B, W), max(B, W)", "min(B, W)", "x", "W += 1", "1", "W", "pre = \"X\"", "\"X\"", "pre" ]
S = input() pre = "X" B, W = 0, 0 for s in S: if s != pre: if s == "B": B += 1 else: W += 1 pre = s if B == 0 or W == 0: print(0) elif B == W: print(B * 2 - 1) else: x, y = min(B, W), max(B, W) print(x * 2)
[ 7, 15, 0, 13, 4, 13, 0, 13, 4, 13, 13, 14, 2, 2, 18, 13, 17, 17, 2, 18, 13, 17, 17, 4, 13, 17, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 13, 17, 0, 13, 18, 13, 13, 9, 14, 2, 13, 18, 13, 13, 9, 0, 13, 17, 0, 13, 18, 13, 13, 9, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 18, 13, 10, 18, 13 ]
[ [ 71, 3 ], [ 80, 7 ], [ 72, 10 ], [ 81, 15 ], [ 81, 20 ], [ 83, 29 ], [ 74, 32 ], [ 36, 35 ], [ 72, 40 ], [ 35, 43 ], [ 86, 46 ], [ 72, 48 ], [ 35, 49 ], [ 87, 53 ], [ 84, 53 ], [ 90, 53 ], [ 72, 55 ], [ 35, 56 ], [ 77, 59 ], [ 89, 62 ], [ 72, 64 ], [ 35, 65 ], [ 78, 69 ], [ 75, 69 ], [ 71, 72 ], [ 74, 75 ], [ 77, 78 ], [ 80, 81 ], [ 83, 84 ], [ 86, 87 ], [ 89, 90 ] ]
[ "from collections import Counter\nS = input()\n\nc = Counter(S)\nif c['W'] == 0 or c['B'] == 0:\n print(0)\n exit()\n\nnow = ''\ncount = 0\nfor i in range(len(S)):\n if i == 0:\n now = S[i]\n continue\n if now == S[i]:\n continue\n else:\n count += 1\n now = S[i]\n continue\n\nprint(count)", "from collections import Counter", "S = input()", "S", "input()", "input", "c = Counter(S)", "c", "Counter(S)", "Counter", "S", "if c['W'] == 0 or c['B'] == 0:\n print(0)\n exit()", "c['W'] == 0 or c['B'] == 0", "c['W'] == 0", "c['W']", "c", "'W'", "0", "c['B'] == 0", "c['B']", "c", "'B'", "0", "print(0)", "print", "0", "exit()", "exit", "now = ''", "now", "''", "count = 0", "count", "0", "for i in range(len(S)):\n if i == 0:\n now = S[i]\n continue\n if now == S[i]:\n continue\n else:\n count += 1\n now = S[i]\n continue", "i", "range(len(S))", "range", "len(S)", "len", "S", "if i == 0:\n now = S[i]\n continue\n ", "i == 0", "i", "0", "now = S[i]", "now", "S[i]", "S", "i", "continue", "if now == S[i]:\n continue\n else:\n count += 1\n now = S[i]\n continue", "now == S[i]", "now", "S[i]", "S", "i", "continue", "count += 1", "count", "1", "now = S[i]", "now", "S[i]", "S", "i", "continue", "print(count)", "print", "count", "S = input()", "input()", "S", "count = 0", "0", "count", "count += 1", "1", "count", "c = Counter(S)", "Counter(S)", "c", "now = ''", "''", "now", "now = S[i]", "S[i]", "now", "now = S[i]", "S[i]", "now" ]
from collections import Counter S = input() c = Counter(S) if c['W'] == 0 or c['B'] == 0: print(0) exit() now = '' count = 0 for i in range(len(S)): if i == 0: now = S[i] continue if now == S[i]: continue else: count += 1 now = S[i] continue print(count)
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 17, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 18, 13, 39, 17, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 18, 13, 10, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 60, 2 ], [ 51, 6 ], [ 61, 9 ], [ 52, 12 ], [ 45, 18 ], [ 61, 20 ], [ 54, 23 ], [ 27, 26 ], [ 61, 28 ], [ 26, 33 ], [ 46, 34 ], [ 49, 34 ], [ 57, 36 ], [ 48, 39 ], [ 26, 40 ], [ 58, 43 ], [ 55, 43 ], [ 45, 46 ], [ 26, 48 ], [ 48, 49 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ] ]
[ "S = input()\nN = len(S)\n\nif N==1:\n print(0)\nelse:\n b = S[0]\n ans = 0\n for i in S[1:]:\n if i!=b:\n ans += 1\n b = i\n print(ans)", "S = input()", "S", "input()", "input", "N = len(S)", "N", "len(S)", "len", "S", "if N==1:\n print(0)\nelse:\n b = S[0]\n ans = 0\n for i in S[1:]:\n if i!=b:\n ans += 1\n b = i\n print(ans)", "N==1", "N", "1", "print(0)", "print", "0", "b = S[0]", "b", "S[0]", "S", "0", "ans = 0", "ans", "0", "for i in S[1:]:\n if i!=b:\n ans += 1\n b = i\n ", "i", "S[1:]", "S", "1:", "1", "if i!=b:\n ans += 1\n b = i\n ", "i!=b", "i", "b", "ans += 1", "ans", "1", "b = i", "b", "i", "print(ans)", "print", "ans", "b = S[0]", "S[0]", "b", "b = i", "i", "b", "N = len(S)", "len(S)", "N", "ans = 0", "0", "ans", "ans += 1", "1", "ans", "S = input()", "input()", "S" ]
S = input() N = len(S) if N==1: print(0) else: b = S[0] ans = 0 for i in S[1:]: if i!=b: ans += 1 b = i print(ans)
[ 7, 12, 13, 0, 13, 17, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 18, 13, 13, 13, 14, 2, 18, 13, 13, 17, 0, 13, 17, 14, 2, 18, 13, 13, 17, 0, 13, 17, 37, 13, 0, 13, 18, 13, 13, 29, 39, 13, 13, 23, 13, 12, 13, 0, 13, 4, 13, 13, 13, 14, 2, 4, 13, 2, 13, 13, 17, 29, 2, 2, 2, 13, 17, 17, 17, 29, 2, 4, 13, 13, 13, 17, 23, 13, 12, 13, 0, 13, 4, 13, 4, 13, 4, 13, 13, 29, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 8, 7 ], [ 11, 10 ], [ 14, 13 ], [ 55, 18 ], [ 55, 22 ], [ 13, 23 ], [ 10, 24 ], [ 46, 24 ], [ 55, 28 ], [ 13, 29 ], [ 33, 32 ], [ 55, 37 ], [ 13, 38 ], [ 42, 41 ], [ 47, 46 ], [ 55, 48 ], [ 13, 49 ], [ 55, 55 ], [ 60, 59 ], [ 115, 61 ], [ 88, 62 ], [ 60, 63 ], [ 59, 69 ], [ 63, 70 ], [ 59, 76 ], [ 59, 84 ], [ 63, 85 ], [ 88, 88 ], [ 93, 92 ], [ 109, 98 ], [ 92, 99 ], [ 112, 106 ] ]
[ "#!/usr/bin/env python3\n\n# from numba import njit\n\n# input = stdin.readline\n\ndef calcGroup(s):\n whiteCount = 0\n blackCount = 0\n prev = \"\"\n for i in range(len(s)):\n if s[i] == prev:\n pass\n else:\n if s[i] == \"W\":\n whiteCount += 1\n elif s[i] == \"B\":\n blackCount += 1\n else:\n raise ValueError\n prev = s[i]\n return whiteCount,blackCount\n\n# @njit\ndef solve(s):\n white,black = calcGroup(s)\n if abs(white-black) == 0:\n return (white-1)*2+1\n else:\n return min(white,black)*2\n\n\n\ndef main():\n s = input()\n print(solve(s))\n return\n\nif __name__ == '__main__':\n main()", "def calcGroup(s):\n whiteCount = 0\n blackCount = 0\n prev = \"\"\n for i in range(len(s)):\n if s[i] == prev:\n pass\n else:\n if s[i] == \"W\":\n whiteCount += 1\n elif s[i] == \"B\":\n blackCount += 1\n else:\n raise ValueError\n prev = s[i]\n return whiteCount,blackCount\n\n# @njit", "calcGroup", "whiteCount = 0", "whiteCount", "0", "blackCount = 0", "blackCount", "0", "prev = \"\"", "prev", "\"\"", "for i in range(len(s)):\n if s[i] == prev:\n pass\n else:\n if s[i] == \"W\":\n whiteCount += 1\n elif s[i] == \"B\":\n blackCount += 1\n else:\n raise ValueError\n prev = s[i]\n ", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i] == prev:\n pass\n else:\n if s[i] == \"W\":\n whiteCount += 1\n elif s[i] == \"B\":\n blackCount += 1\n else:\n raise ValueError\n ", "s[i] == prev", "s[i]", "s", "i", "prev", "if s[i] == \"W\":\n whiteCount += 1\n elif s[i] == \"B\":\n blackCount += 1\n else:\n raise ValueError\n ", "s[i] == \"W\"", "s[i]", "s", "i", "\"W\"", "whiteCount += 1", "whiteCount", "1", "elif s[i] == \"B\":\n blackCount += 1\n ", "s[i] == \"B\"", "s[i]", "s", "i", "\"B\"", "blackCount += 1", "blackCount", "1", "raise ValueError", "ValueError", "prev = s[i]", "prev", "s[i]", "s", "i", "return whiteCount,blackCount", "return whiteCount,blackCount", "whiteCount", "blackCount", "s", "s", "def solve(s):\n white,black = calcGroup(s)\n if abs(white-black) == 0:\n return (white-1)*2+1\n else:\n return min(white,black)*2", "solve", "white,black = calcGroup(s)", "white", "calcGroup(s)", "calcGroup", "s", "black", "if abs(white-black) == 0:\n return (white-1)*2+1\n else:\n return min(white,black)*2", "abs(white-black) == 0", "abs(white-black)", "abs", "white-black", "white", "black", "0", "return (white-1)*2+1", "(white-1)*2+1", "(white-1)*2", "white-1", "white", "1", "2", "1", "return min(white,black)*2", "min(white,black)*2", "min(white,black)", "min", "white", "black", "2", "s", "s", "def main():\n s = input()\n print(solve(s))\n return", "main", "s = input()", "s", "input()", "input", "print(solve(s))", "print", "solve(s)", "solve", "s", "return", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def solve(s):\n white,black = calcGroup(s)\n if abs(white-black) == 0:\n return (white-1)*2+1\n else:\n return min(white,black)*2", "def solve(s):\n white,black = calcGroup(s)\n if abs(white-black) == 0:\n return (white-1)*2+1\n else:\n return min(white,black)*2", "solve", "def main():\n s = input()\n print(solve(s))\n return", "def main():\n s = input()\n print(solve(s))\n return", "main", "def calcGroup(s):\n whiteCount = 0\n blackCount = 0\n prev = \"\"\n for i in range(len(s)):\n if s[i] == prev:\n pass\n else:\n if s[i] == \"W\":\n whiteCount += 1\n elif s[i] == \"B\":\n blackCount += 1\n else:\n raise ValueError\n prev = s[i]\n return whiteCount,blackCount\n\n# @njit", "def calcGroup(s):\n whiteCount = 0\n blackCount = 0\n prev = \"\"\n for i in range(len(s)):\n if s[i] == prev:\n pass\n else:\n if s[i] == \"W\":\n whiteCount += 1\n elif s[i] == \"B\":\n blackCount += 1\n else:\n raise ValueError\n prev = s[i]\n return whiteCount,blackCount\n\n# @njit", "calcGroup" ]
#!/usr/bin/env python3 # from numba import njit # input = stdin.readline def calcGroup(s): whiteCount = 0 blackCount = 0 prev = "" for i in range(len(s)): if s[i] == prev: pass else: if s[i] == "W": whiteCount += 1 elif s[i] == "B": blackCount += 1 else: raise ValueError prev = s[i] return whiteCount,blackCount # @njit def solve(s): white,black = calcGroup(s) if abs(white-black) == 0: return (white-1)*2+1 else: return min(white,black)*2 def main(): s = input() print(solve(s)) return if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 13, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 18, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13 ]
[ [ 39, 2 ], [ 36, 6 ], [ 33, 9 ], [ 40, 11 ], [ 15, 14 ], [ 40, 14 ], [ 34, 18 ], [ 43, 18 ], [ 14, 19 ], [ 42, 21 ], [ 14, 22 ], [ 30, 24 ], [ 31, 28 ], [ 37, 28 ], [ 30, 31 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 14, 42 ], [ 42, 43 ] ]
[ "S = input()\nc = 0\nstone = S[0]\nfor s in S:\n if stone != s:\n stone = s\n c += 1\nprint(c)", "S = input()", "S", "input()", "input", "c = 0", "c", "0", "stone = S[0]", "stone", "S[0]", "S", "0", "for s in S:\n if stone != s:\n stone = s\n c += 1", "s", "S", "if stone != s:\n stone = s\n c += 1", "stone != s", "stone", "s", "stone = s", "stone", "s", "c += 1", "c", "1", "print(c)", "print", "c", "c += 1", "1", "c", "stone = S[0]", "S[0]", "stone", "c = 0", "0", "c", "S = input()", "input()", "S", "stone = s", "s", "stone" ]
S = input() c = 0 stone = S[0] for s in S: if stone != s: stone = s c += 1 print(c)
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 2, 13, 18, 13, 13, 14, 40, 13, 18, 13, 13, 0, 13, 17, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 18, 13, 10, 4, 13, 10, 18, 13, 10, 17, 13 ]
[ [ 57, 2 ], [ 60, 6 ], [ 58, 8 ], [ 63, 11 ], [ 15, 14 ], [ 58, 20 ], [ 61, 23 ], [ 55, 23 ], [ 58, 25 ], [ 14, 26 ], [ 61, 29 ], [ 55, 29 ], [ 58, 31 ], [ 14, 32 ], [ 51, 34 ], [ 48, 37 ], [ 54, 40 ], [ 58, 42 ], [ 14, 43 ], [ 52, 46 ], [ 64, 46 ], [ 48, 49 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ] ]
[ "s= input()\n\nnow = s[0]\nans = 0\nfor i in range(1,len(s)):\n if now == s[i]:\n pass\n elif now != s[i]:\n ans += 1\n flg = 1\n now = s[i]\n\nprint(ans)", "s= input()", "s", "input()", "input", "now = s[0]", "now", "s[0]", "s", "0", "ans = 0", "ans", "0", "for i in range(1,len(s)):\n if now == s[i]:\n pass\n elif now != s[i]:\n ans += 1\n flg = 1\n now = s[i]", "i", "range(1,len(s))", "range", "1", "len(s)", "len", "s", "if now == s[i]:\n pass\n elif now != s[i]:\n ans += 1\n flg = 1\n now = s[i]", "now == s[i]", "now", "s[i]", "s", "i", "elif now != s[i]:\n ans += 1\n flg = 1\n now = s[i]", "now != s[i]", "now", "s[i]", "s", "i", "ans += 1", "ans", "1", "flg = 1", "flg", "1", "now = s[i]", "now", "s[i]", "s", "i", "print(ans)", "print", "ans", "flg = 1", "1", "flg", "ans += 1", "1", "ans", "now = s[i]", "s[i]", "now", "s= input()", "input()", "s", "now = s[0]", "s[0]", "now", "ans = 0", "0", "ans" ]
s= input() now = s[0] ans = 0 for i in range(1,len(s)): if now == s[i]: pass elif now != s[i]: ans += 1 flg = 1 now = s[i] print(ans)
[ 7, 15, 13, 12, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 13, 0, 13, 17, 29, 13, 23, 13, 0, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 4, 13, 4, 13, 13, 10, 4, 13, 10, 12, 13 ]
[ [ 7, 6 ], [ 10, 9 ], [ 29, 11 ], [ 15, 14 ], [ 29, 14 ], [ 9, 18 ], [ 21, 18 ], [ 14, 19 ], [ 22, 21 ], [ 14, 22 ], [ 25, 24 ], [ 24, 27 ], [ 6, 27 ], [ 29, 29 ], [ 47, 31 ], [ 51, 44 ], [ 48, 45 ], [ 47, 48 ] ]
[ "import sys\n\ndef main(s):\n counter=0\n cf=s[0]\n for x in s:\n if cf!=x:\n cf=x\n counter+=1\n return counter\n\ns=sys.stdin.readline().strip()\nprint(main(s))", "import sys", "sys", "def main(s):\n counter=0\n cf=s[0]\n for x in s:\n if cf!=x:\n cf=x\n counter+=1\n return counter", "main", "counter=0", "counter", "0", "cf=s[0]", "cf", "s[0]", "s", "0", "for x in s:\n if cf!=x:\n cf=x\n counter+=1\n ", "x", "s", "if cf!=x:\n cf=x\n counter+=1\n ", "cf!=x", "cf", "x", "cf=x", "cf", "x", "counter+=1", "counter", "1", "return counter", "counter", "s", "s", "s=sys.stdin.readline().strip()", "s", "sys.stdin.readline().strip()", "sys.stdin.readline().strip", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "strip", "print(main(s))", "print", "main(s)", "main", "s", "s=sys.stdin.readline().strip()", "sys.stdin.readline().strip()", "s", "def main(s):\n counter=0\n cf=s[0]\n for x in s:\n if cf!=x:\n cf=x\n counter+=1\n return counter", "def main(s):\n counter=0\n cf=s[0]\n for x in s:\n if cf!=x:\n cf=x\n counter+=1\n return counter", "main" ]
import sys def main(s): counter=0 cf=s[0] for x in s: if cf!=x: cf=x counter+=1 return counter s=sys.stdin.readline().strip() print(main(s))
[ 7, 15, 13, 12, 13, 0, 13, 17, 0, 13, 4, 13, 17, 4, 18, 13, 13, 2, 17, 17, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 28, 13, 4, 13, 2, 13, 17, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 7, 6 ], [ 10, 9 ], [ 36, 35 ], [ 21, 37 ], [ 40, 39 ], [ 35, 42 ], [ 45, 44 ], [ 48, 47 ], [ 39, 51 ], [ 35, 56 ], [ 47, 57 ], [ 35, 59 ], [ 47, 61 ], [ 65, 64 ], [ 64, 68 ], [ 44, 68 ], [ 77, 74 ] ]
[ "#!/usr/bin/env python3\n\nimport sys\n# import time\n# import math\n# import numpy as np\n# import scipy.sparse.csgraph as cs # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall\n# import random # random, uniform, randint, randrange, shuffle, sample\n# import string # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits\n# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)\n# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).\n# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()\n# from collections import defaultdict # subclass of dict. defaultdict(facroty)\n# from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)\n# from datetime import date, datetime # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj\n# from datetime.datetime import strptime # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj\n# from datetime import timedelta # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.\n# from copy import copy, deepcopy # use deepcopy to copy multi-dimentional matrix without reference\n# from functools import reduce # reduce(f, iter[, init])\n# from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)\n# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).\n# from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).\n# from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n])\n# from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]\n# from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9]\n# from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r])\n# from itertools import combinations, combinations_with_replacement\n# from itertools import accumulate # accumulate(iter[, f])\n# from operator import itemgetter # itemgetter(1), itemgetter('key')\n# from fractions import gcd # for Python 3.4 (previous contest @AtCoder)\n\n\n\ndef main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n \n \n board = input()\n n = len(board)\n cnt = 0\n for i in range(n-1):\n if board[i] != board[i+1]:\n cnt += 1\n print(cnt)\n\n\nif __name__ == \"__main__\":\n main()", "import sys", "sys", "def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n \n \n board = input()\n n = len(board)\n cnt = 0\n for i in range(n-1):\n if board[i] != board[i+1]:\n cnt += 1\n print(cnt)", "main", "mod = 1000000007", "mod", "1000000007", "inf = float('inf')", "inf", "float('inf')", "float", "'inf'", "sys.setrecursionlimit(10**6)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**6", "10", "6", "def input(): return sys.stdin.readline().rstrip()\n ", "input", "def ii(): return int(input())\n ", "ii", "def mi(): return map(int, input().split())\n ", "mi", "def mi_0(): return map(lambda x: int(x)-1, input().split())\n ", "mi_0", "def lmi(): return list(map(int, input().split()))\n ", "lmi", "def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n ", "lmi_0", "def li(): return list(input())\n \n \n ", "li", "board = input()", "board", "input()", "input", "n = len(board)", "n", "len(board)", "len", "board", "cnt = 0", "cnt", "0", "for i in range(n-1):\n if board[i] != board[i+1]:\n cnt += 1\n ", "i", "range(n-1)", "range", "n-1", "n", "1", "if board[i] != board[i+1]:\n cnt += 1\n ", "board[i] != board[i+1]", "board[i]", "board", "i", "board[i+1]", "board", "i+1", "i", "1", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n \n \n board = input()\n n = len(board)\n cnt = 0\n for i in range(n-1):\n if board[i] != board[i+1]:\n cnt += 1\n print(cnt)", "def main():\n mod = 1000000007 # 10^9+7\n inf = float('inf') # sys.float_info.max = 1.79...e+308\n # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19\n sys.setrecursionlimit(10**6) # 1000 -> 1000000\n def input(): return sys.stdin.readline().rstrip()\n def ii(): return int(input())\n def mi(): return map(int, input().split())\n def mi_0(): return map(lambda x: int(x)-1, input().split())\n def lmi(): return list(map(int, input().split()))\n def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))\n def li(): return list(input())\n \n \n board = input()\n n = len(board)\n cnt = 0\n for i in range(n-1):\n if board[i] != board[i+1]:\n cnt += 1\n print(cnt)", "main" ]
#!/usr/bin/env python3 import sys # import time # import math # import numpy as np # import scipy.sparse.csgraph as cs # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall # import random # random, uniform, randint, randrange, shuffle, sample # import string # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits # import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s) # from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]). # from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate() # from collections import defaultdict # subclass of dict. defaultdict(facroty) # from collections import Counter # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter) # from datetime import date, datetime # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj # from datetime.datetime import strptime # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj # from datetime import timedelta # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available. # from copy import copy, deepcopy # use deepcopy to copy multi-dimentional matrix without reference # from functools import reduce # reduce(f, iter[, init]) # from functools import lru_cache # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed) # from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn). # from heapq import nlargest, nsmallest # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn). # from itertools import count, cycle, repeat # count(start[,step]), cycle(iter), repeat(elm[,n]) # from itertools import groupby # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])] # from itertools import starmap # starmap(pow, [[2,5], [3,2]]) returns [32, 9] # from itertools import product, permutations # product(iter, repeat=n), permutations(iter[,r]) # from itertools import combinations, combinations_with_replacement # from itertools import accumulate # accumulate(iter[, f]) # from operator import itemgetter # itemgetter(1), itemgetter('key') # from fractions import gcd # for Python 3.4 (previous contest @AtCoder) def main(): mod = 1000000007 # 10^9+7 inf = float('inf') # sys.float_info.max = 1.79...e+308 # inf = 2 ** 64 - 1 # (for fast JIT compile in PyPy) 1.84...e+19 sys.setrecursionlimit(10**6) # 1000 -> 1000000 def input(): return sys.stdin.readline().rstrip() def ii(): return int(input()) def mi(): return map(int, input().split()) def mi_0(): return map(lambda x: int(x)-1, input().split()) def lmi(): return list(map(int, input().split())) def lmi_0(): return list(map(lambda x: int(x)-1, input().split())) def li(): return list(input()) board = input() n = len(board) cnt = 0 for i in range(n-1): if board[i] != board[i+1]: cnt += 1 print(cnt) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 0, 13, 18, 13, 17, 0, 13, 4, 13, 13, 42, 17, 28, 13, 4, 13, 2, 13, 17, 13, 14, 40, 18, 13, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 0, 13, 13, 3, 4, 13, 13, 10, 4, 13, 10, 18, 13, 10, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 18, 13, 10, 4, 13 ]
[ [ 74, 2 ], [ 62, 6 ], [ 65, 9 ], [ 56, 12 ], [ 75, 14 ], [ 53, 17 ], [ 75, 20 ], [ 25, 24 ], [ 66, 28 ], [ 60, 28 ], [ 54, 30 ], [ 75, 34 ], [ 24, 35 ], [ 57, 36 ], [ 72, 36 ], [ 68, 38 ], [ 71, 41 ], [ 75, 43 ], [ 24, 44 ], [ 59, 46 ], [ 24, 47 ], [ 69, 51 ], [ 63, 51 ], [ 53, 54 ], [ 56, 57 ], [ 24, 59 ], [ 59, 60 ], [ 62, 63 ], [ 65, 66 ], [ 68, 69 ], [ 71, 72 ], [ 74, 75 ] ]
[ "s=input()\ncnt=0\ni=0\nj=s[0]\nn=len(s)\nwhile True:\n for k in range(i+1,n):\n if s[k]!=j:\n cnt+=1\n j=s[k]\n i=k\n break\n else:break\nprint(cnt)", "s=input()", "s", "input()", "input", "cnt=0", "cnt", "0", "i=0", "i", "0", "j=s[0]", "j", "s[0]", "s", "0", "n=len(s)", "n", "len(s)", "len", "s", "while True:\n for k in range(i+1,n):\n if s[k]!=j:\n cnt+=1\n j=s[k]\n i=k\n break\n else:break", "True", "for k in range(i+1,n):\n if s[k]!=j:\n cnt+=1\n j=s[k]\n i=k\n break\n else:break", "k", "range(i+1,n)", "range", "i+1", "i", "1", "n", "if s[k]!=j:\n cnt+=1\n j=s[k]\n i=k\n break\n ", "s[k]!=j", "s[k]", "s", "k", "j", "cnt+=1", "cnt", "1", "j=s[k]", "j", "s[k]", "s", "k", "i=k", "i", "k", "break", "print(cnt)", "print", "cnt", "n=len(s)", "len(s)", "n", "j=s[0]", "s[0]", "j", "i=k", "k", "i", "cnt=0", "0", "cnt", "i=0", "0", "i", "cnt+=1", "1", "cnt", "j=s[k]", "s[k]", "j", "s=input()", "input()", "s" ]
s=input() cnt=0 i=0 j=s[0] n=len(s) while True: for k in range(i+1,n): if s[k]!=j: cnt+=1 j=s[k] i=k break else:break print(cnt)
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 17, 14, 2, 18, 13, 17, 17, 28, 13, 4, 13, 2, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 2, 13, 17, 17, 0, 13, 17, 14, 2, 18, 13, 17, 17, 0, 13, 17, 14, 2, 18, 13, 17, 17, 28, 13, 4, 13, 2, 13, 17, 14, 2, 2, 18, 13, 13, 17, 2, 18, 13, 2, 13, 17, 17, 0, 13, 17, 14, 2, 18, 13, 17, 17, 0, 13, 17, 14, 2, 13, 17, 4, 13, 13, 4, 13, 2, 2, 2, 13, 17, 17, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 4, 11 ], [ 14, 13 ], [ 17, 16 ], [ 4, 21 ], [ 26, 25 ], [ 8, 29 ], [ 4, 35 ], [ 25, 36 ], [ 4, 40 ], [ 25, 42 ], [ 47, 46 ], [ 4, 51 ], [ 56, 55 ], [ 4, 60 ], [ 65, 64 ], [ 8, 68 ], [ 4, 74 ], [ 64, 75 ], [ 4, 79 ], [ 64, 81 ], [ 86, 85 ], [ 4, 90 ], [ 95, 94 ], [ 85, 98 ], [ 46, 98 ], [ 13, 98 ], [ 85, 102 ], [ 46, 102 ], [ 13, 102 ], [ 85, 108 ], [ 46, 108 ], [ 13, 108 ], [ 94, 111 ], [ 55, 111 ], [ 16, 111 ], [ 120, 117 ] ]
[ "def main():\n s = input()\n slen = len(s)\n cnt = 0\n last = 0\n if s[0] == \"W\":\n for i in range(slen-1):\n if s[i] == \"W\" and s[i+1] ==\"B\":\n cnt += 1\n if s[-1] == \"W\":\n last = 1\n if s[0] == \"B\":\n for i in range(slen-1):\n if s[i] == \"B\" and s[i+1] ==\"W\":\n cnt += 1\n if s[-1] == \"B\":\n last = 1 \n if cnt == 0:\n print(cnt)\n else:\n print(cnt*2 - 1 + last)\n \n\n \n \n \nif __name__ == \"__main__\":\n main()", "def main():\n s = input()\n slen = len(s)\n cnt = 0\n last = 0\n if s[0] == \"W\":\n for i in range(slen-1):\n if s[i] == \"W\" and s[i+1] ==\"B\":\n cnt += 1\n if s[-1] == \"W\":\n last = 1\n if s[0] == \"B\":\n for i in range(slen-1):\n if s[i] == \"B\" and s[i+1] ==\"W\":\n cnt += 1\n if s[-1] == \"B\":\n last = 1 \n if cnt == 0:\n print(cnt)\n else:\n print(cnt*2 - 1 + last)\n \n\n \n \n ", "main", "s = input()", "s", "input()", "input", "slen = len(s)", "slen", "len(s)", "len", "s", "cnt = 0", "cnt", "0", "last = 0", "last", "0", "if s[0] == \"W\":\n for i in range(slen-1):\n if s[i] == \"W\" and s[i+1] ==\"B\":\n cnt += 1\n if s[-1] == \"W\":\n last = 1\n ", "s[0] == \"W\"", "s[0]", "s", "0", "\"W\"", "for i in range(slen-1):\n if s[i] == \"W\" and s[i+1] ==\"B\":\n cnt += 1\n ", "i", "range(slen-1)", "range", "slen-1", "slen", "1", "if s[i] == \"W\" and s[i+1] ==\"B\":\n cnt += 1\n ", "s[i] == \"W\" and s[i+1] ==\"B\"", "s[i] == \"W\"", "s[i]", "s", "i", "\"W\"", "s[i+1] ==\"B\"", "s[i+1]", "s", "i+1", "i", "1", "\"B\"", "cnt += 1", "cnt", "1", "if s[-1] == \"W\":\n last = 1\n ", "s[-1] == \"W\"", "s[-1]", "s", "-1", "\"W\"", "last = 1", "last", "1", "if s[0] == \"B\":\n for i in range(slen-1):\n if s[i] == \"B\" and s[i+1] ==\"W\":\n cnt += 1\n if s[-1] == \"B\":\n last = 1 \n ", "s[0] == \"B\"", "s[0]", "s", "0", "\"B\"", "for i in range(slen-1):\n if s[i] == \"B\" and s[i+1] ==\"W\":\n cnt += 1\n ", "i", "range(slen-1)", "range", "slen-1", "slen", "1", "if s[i] == \"B\" and s[i+1] ==\"W\":\n cnt += 1\n ", "s[i] == \"B\" and s[i+1] ==\"W\"", "s[i] == \"B\"", "s[i]", "s", "i", "\"B\"", "s[i+1] ==\"W\"", "s[i+1]", "s", "i+1", "i", "1", "\"W\"", "cnt += 1", "cnt", "1", "if s[-1] == \"B\":\n last = 1 \n ", "s[-1] == \"B\"", "s[-1]", "s", "-1", "\"B\"", "last = 1", "last", "1", "if cnt == 0:\n print(cnt)\n else:\n print(cnt*2 - 1 + last)\n \n\n \n \n ", "cnt == 0", "cnt", "0", "print(cnt)", "print", "cnt", "print(cnt*2 - 1 + last)", "print", "cnt*2 - 1 + last", "cnt*2 - 1", "cnt*2", "cnt", "2", "1", "last", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def main():\n s = input()\n slen = len(s)\n cnt = 0\n last = 0\n if s[0] == \"W\":\n for i in range(slen-1):\n if s[i] == \"W\" and s[i+1] ==\"B\":\n cnt += 1\n if s[-1] == \"W\":\n last = 1\n if s[0] == \"B\":\n for i in range(slen-1):\n if s[i] == \"B\" and s[i+1] ==\"W\":\n cnt += 1\n if s[-1] == \"B\":\n last = 1 \n if cnt == 0:\n print(cnt)\n else:\n print(cnt*2 - 1 + last)\n \n\n \n \n ", "def main():\n s = input()\n slen = len(s)\n cnt = 0\n last = 0\n if s[0] == \"W\":\n for i in range(slen-1):\n if s[i] == \"W\" and s[i+1] ==\"B\":\n cnt += 1\n if s[-1] == \"W\":\n last = 1\n if s[0] == \"B\":\n for i in range(slen-1):\n if s[i] == \"B\" and s[i+1] ==\"W\":\n cnt += 1\n if s[-1] == \"B\":\n last = 1 \n if cnt == 0:\n print(cnt)\n else:\n print(cnt*2 - 1 + last)\n \n\n \n \n ", "main" ]
def main(): s = input() slen = len(s) cnt = 0 last = 0 if s[0] == "W": for i in range(slen-1): if s[i] == "W" and s[i+1] =="B": cnt += 1 if s[-1] == "W": last = 1 if s[0] == "B": for i in range(slen-1): if s[i] == "B" and s[i+1] =="W": cnt += 1 if s[-1] == "B": last = 1 if cnt == 0: print(cnt) else: print(cnt*2 - 1 + last) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 0, 13, 2, 13, 17, 0, 13, 39, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 2, 18, 13, 2, 13, 17, 18, 13, 13, 0, 13, 17, 4, 18, 13, 13, 13, 0, 13, 17, 4, 13, 2, 4, 13, 13, 17, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 2, 13, 10, 39, 13, 10, 17, 13 ]
[ [ 56, 2 ], [ 62, 6 ], [ 57, 8 ], [ 65, 11 ], [ 68, 14 ], [ 18, 17 ], [ 63, 23 ], [ 57, 23 ], [ 63, 27 ], [ 57, 27 ], [ 17, 29 ], [ 63, 32 ], [ 57, 32 ], [ 17, 33 ], [ 53, 35 ], [ 66, 39 ], [ 69, 41 ], [ 60, 41 ], [ 54, 41 ], [ 59, 43 ], [ 66, 50 ], [ 53, 54 ], [ 56, 57 ], [ 59, 60 ], [ 62, 63 ], [ 65, 66 ], [ 68, 69 ] ]
[ "#81 C - 一次元リバーシ\nS = input()\nS = S + '1'# 番兵\n\n# 連続する文字をカウント\ncnt = []\nconti = 1\nfor i in range(1,len(S)):\n if S[i-1] == S[i]:\n conti += 1\n else:\n cnt.append(conti)\n conti = 1\nprint(len(cnt)-1)", "S = input()", "S", "input()", "input", "S = S + '1'", "S", "S + '1'", "S", "'1'", "cnt = []", "cnt", "[]", "conti = 1", "conti", "1", "for i in range(1,len(S)):\n if S[i-1] == S[i]:\n conti += 1\n else:\n cnt.append(conti)\n conti = 1", "i", "range(1,len(S))", "range", "1", "len(S)", "len", "S", "if S[i-1] == S[i]:\n conti += 1\n else:\n cnt.append(conti)\n conti = 1", "S[i-1] == S[i]", "S[i-1]", "S", "i-1", "i", "1", "S[i]", "S", "i", "conti += 1", "conti", "1", "cnt.append(conti)", "cnt.append", "cnt", "append", "conti", "conti = 1", "conti", "1", "print(len(cnt)-1)", "print", "len(cnt)-1", "len(cnt)", "len", "cnt", "1", "conti += 1", "1", "conti", "S = input()", "input()", "S", "conti = 1", "1", "conti", "S = S + '1'", "S + '1'", "S", "cnt = []", "[]", "cnt", "conti = 1", "1", "conti" ]
#81 C - 一次元リバーシ S = input() S = S + '1'# 番兵 # 連続する文字をカウント cnt = [] conti = 1 for i in range(1,len(S)): if S[i-1] == S[i]: conti += 1 else: cnt.append(conti) conti = 1 print(len(cnt)-1)
[ 7, 0, 13, 39, 28, 13, 4, 13, 14, 2, 2, 4, 13, 13, 17, 40, 18, 13, 17, 13, 13, 2, 4, 13, 13, 17, 10, 39, 13 ]
[ [ 27, 2 ], [ 6, 5 ], [ 28, 13 ], [ 28, 17 ], [ 5, 19 ], [ 28, 24 ], [ 27, 28 ] ]
[ "stack = []\nfor l in raw_input():\n\tif len(stack) == 0 or stack[-1] != l: stack.append(l)\nprint len(stack) -1", "stack = []", "stack", "[]", "for l in raw_input():\n\tif len(stack) == 0 or stack[-1] != l: stack.append(l)", "l", "raw_input()", "raw_input", "if len(stack) == 0 or stack[-1] != l: stack.append(l", "len(stack) == 0 or stack[-1] != l", "len(stack) == 0", "len(stack)", "len", "stack", "0", "stack[-1] != l", "stack[-1]", "stack", "-1", "l", "print", "len(stack) -1", "len(stack)", "len", "stack", "1", "stack = []", "[]", "stack" ]
stack = [] for l in raw_input(): if len(stack) == 0 or stack[-1] != l: stack.append(l) print len(stack) -1
[ 7, 15, 0, 13, 4, 13, 0, 13, 4, 13, 13, 14, 2, 2, 4, 18, 13, 13, 17, 13, 2, 4, 18, 13, 13, 17, 13, 4, 13, 17, 4, 13, 0, 13, 17, 28, 13, 4, 18, 13, 13, 17, 14, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 18, 13, 13, 17, 14, 13, 0, 13, 17, 4, 13, 2, 2, 4, 13, 2, 13, 13, 2, 4, 13, 13, 13, 17, 17, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 91, 3 ], [ 82, 7 ], [ 92, 10 ], [ 92, 16 ], [ 83, 19 ], [ 92, 23 ], [ 83, 26 ], [ 85, 33 ], [ 37, 36 ], [ 92, 39 ], [ 94, 45 ], [ 88, 48 ], [ 52, 51 ], [ 92, 54 ], [ 79, 60 ], [ 80, 69 ], [ 89, 69 ], [ 95, 70 ], [ 86, 70 ], [ 80, 74 ], [ 89, 74 ], [ 95, 75 ], [ 86, 75 ], [ 79, 80 ], [ 82, 83 ], [ 85, 86 ], [ 88, 89 ], [ 91, 92 ], [ 94, 95 ] ]
[ "from sys import exit\nS = input()\n#0回判定\nx = len(S)\nif S.count(\"B\") == x or S.count(\"W\") == x:\n print(0)\n exit()\n\n\n\ncntw=0\nfor s in S.split(\"W\"):\n if s:\n cntw += 1\ncntb=0\nfor s in S.split(\"B\"):\n if s:\n cntb += 1\nprint(abs(cntb - cntw) + min(cntb, cntw) * 2 - 1)", "from sys import exit", "S = input()", "S", "input()", "input", "x = len(S)", "x", "len(S)", "len", "S", "if S.count(\"B\") == x or S.count(\"W\") == x:\n print(0)\n exit()", "S.count(\"B\") == x or S.count(\"W\") == x", "S.count(\"B\") == x", "S.count(\"B\")", "S.count", "S", "count", "\"B\"", "x", "S.count(\"W\") == x", "S.count(\"W\")", "S.count", "S", "count", "\"W\"", "x", "print(0)", "print", "0", "exit()", "exit", "cntw=0", "cntw", "0", "for s in S.split(\"W\"):\n if s:\n cntw += 1", "s", "S.split(\"W\")", "S.split", "S", "split", "\"W\"", "if s:\n cntw += 1", "s", "cntw += 1", "cntw", "1", "cntb=0", "cntb", "0", "for s in S.split(\"B\"):\n if s:\n cntb += 1", "s", "S.split(\"B\")", "S.split", "S", "split", "\"B\"", "if s:\n cntb += 1", "s", "cntb += 1", "cntb", "1", "print(abs(cntb - cntw) + min(cntb, cntw) * 2 - 1)", "print", "abs(cntb - cntw) + min(cntb, cntw) * 2 - 1", "abs(cntb - cntw) + min(cntb, cntw) * 2", "abs(cntb - cntw)", "abs", "cntb - cntw", "cntb", "cntw", "min(cntb, cntw) * 2", "min(cntb, cntw)", "min", "cntb", "cntw", "2", "1", "cntb += 1", "1", "cntb", "x = len(S)", "len(S)", "x", "cntw=0", "0", "cntw", "cntb=0", "0", "cntb", "S = input()", "input()", "S", "cntw += 1", "1", "cntw" ]
from sys import exit S = input() #0回判定 x = len(S) if S.count("B") == x or S.count("W") == x: print(0) exit() cntw=0 for s in S.split("W"): if s: cntw += 1 cntb=0 for s in S.split("B"): if s: cntb += 1 print(abs(cntb - cntw) + min(cntb, cntw) * 2 - 1)
[ 7, 15, 0, 13, 4, 13, 4, 13, 0, 13, 17, 0, 13, 4, 18, 13, 13, 28, 13, 4, 13, 4, 13, 13, 0, 13, 4, 18, 13, 13, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 4, 13, 10, 13, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 44, 3 ], [ 56, 9 ], [ 53, 12 ], [ 45, 15 ], [ 19, 18 ], [ 45, 23 ], [ 50, 25 ], [ 45, 28 ], [ 51, 32 ], [ 54, 33 ], [ 48, 33 ], [ 59, 35 ], [ 47, 38 ], [ 51, 39 ], [ 60, 42 ], [ 57, 42 ], [ 44, 45 ], [ 51, 47 ], [ 47, 48 ], [ 50, 51 ], [ 53, 54 ], [ 56, 57 ], [ 59, 60 ] ]
[ "from collections import deque\n\ns = deque(input())\ncnt = 0\np = s.pop()\nfor _ in range(len(s)):\n n = s.pop()\n if n != p:\n cnt += 1\n p = n\nprint(cnt)", "from collections import deque", "s = deque(input())", "s", "deque(input())", "deque", "input()", "input", "cnt = 0", "cnt", "0", "p = s.pop()", "p", "s.pop()", "s.pop", "s", "pop", "for _ in range(len(s)):\n n = s.pop()\n if n != p:\n cnt += 1\n p = n", "_", "range(len(s))", "range", "len(s)", "len", "s", "n = s.pop()", "n", "s.pop()", "s.pop", "s", "pop", "if n != p:\n cnt += 1\n ", "n != p", "n", "p", "cnt += 1", "cnt", "1", "p = n", "p", "n", "print(cnt)", "print", "cnt", "s = deque(input())", "deque(input())", "s", "p = n", "n", "p", "n = s.pop()", "s.pop()", "n", "p = s.pop()", "s.pop()", "p", "cnt = 0", "0", "cnt", "cnt += 1", "1", "cnt" ]
from collections import deque s = deque(input()) cnt = 0 p = s.pop() for _ in range(len(s)): n = s.pop() if n != p: cnt += 1 p = n print(cnt)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 40, 18, 13, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 13, 10, 4, 13, 10, 18, 13, 10, 17, 13, 10, 17, 13, 10, 18, 13 ]
[ [ 38, 2 ], [ 47, 6 ], [ 41, 9 ], [ 39, 11 ], [ 15, 14 ], [ 39, 19 ], [ 39, 23 ], [ 14, 24 ], [ 42, 25 ], [ 51, 25 ], [ 44, 27 ], [ 50, 30 ], [ 39, 32 ], [ 14, 33 ], [ 45, 36 ], [ 48, 36 ], [ 38, 39 ], [ 41, 42 ], [ 44, 45 ], [ 47, 48 ], [ 50, 51 ] ]
[ "s = input()\nans = 0\nx = s[0]\n\nfor i in range(len(s)):\n if s[i] != x:\n ans += 1\n x = s[i]\n\nprint(ans)", "s = input()", "s", "input()", "input", "ans = 0", "ans", "0", "x = s[0]", "x", "s[0]", "s", "0", "for i in range(len(s)):\n if s[i] != x:\n ans += 1\n x = s[i]", "i", "range(len(s))", "range", "len(s)", "len", "s", "if s[i] != x:\n ans += 1\n x = s[i]", "s[i] != x", "s[i]", "s", "i", "x", "ans += 1", "ans", "1", "x = s[i]", "x", "s[i]", "s", "i", "print(ans)", "print", "ans", "s = input()", "input()", "s", "x = s[0]", "s[0]", "x", "ans += 1", "1", "ans", "ans = 0", "0", "ans", "x = s[i]", "s[i]", "x" ]
s = input() ans = 0 x = s[0] for i in range(len(s)): if s[i] != x: ans += 1 x = s[i] print(ans)
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 0, 13, 2, 2, 17, 17, 17, 0, 13, 4, 13, 17, 4, 18, 13, 13, 2, 17, 17, 12, 13, 15, 0, 13, 4, 13, 0, 13, 2, 4, 13, 4, 13, 4, 13, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 4, 13, 10, 12, 13, 10, 18, 13, 10, 2, 13 ]
[ [ 63, 4 ], [ 66, 11 ], [ 57, 18 ], [ 34, 33 ], [ 38, 37 ], [ 33, 45 ], [ 37, 49 ], [ 61, 55 ], [ 57, 58 ], [ 63, 64 ], [ 66, 67 ] ]
[ "import sys\n\nreadline = sys.stdin.readline\nMOD = 10 ** 9 + 7\nINF = float('INF')\nsys.setrecursionlimit(10 ** 5)\n\n\ndef main():\n from itertools import groupby\n s = input()\n ans = len(list(groupby(s))) - 1\n print(ans)\n\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "readline = sys.stdin.readline", "readline", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "MOD = 10 ** 9 + 7", "MOD", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "INF = float('INF')", "INF", "float('INF')", "float", "'INF'", "sys.setrecursionlimit(10 ** 5)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 5", "10", "5", "def main():\n from itertools import groupby\n s = input()\n ans = len(list(groupby(s))) - 1\n print(ans)", "main", "from itertools import groupby", "s = input()", "s", "input()", "input", "ans = len(list(groupby(s))) - 1", "ans", "len(list(groupby(s))) - 1", "len(list(groupby(s)))", "len", "list(groupby(s))", "list", "groupby(s)", "groupby", "s", "1", "print(ans)", "print", "ans", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "INF = float('INF')", "float('INF')", "INF", "def main():\n from itertools import groupby\n s = input()\n ans = len(list(groupby(s))) - 1\n print(ans)", "def main():\n from itertools import groupby\n s = input()\n ans = len(list(groupby(s))) - 1\n print(ans)", "main", "readline = sys.stdin.readline", "sys.stdin.readline", "readline", "MOD = 10 ** 9 + 7", "10 ** 9 + 7", "MOD" ]
import sys readline = sys.stdin.readline MOD = 10 ** 9 + 7 INF = float('INF') sys.setrecursionlimit(10 ** 5) def main(): from itertools import groupby s = input() ans = len(list(groupby(s))) - 1 print(ans) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 38, 2 ], [ 44, 6 ], [ 39, 9 ], [ 41, 11 ], [ 15, 14 ], [ 45, 20 ], [ 45, 24 ], [ 14, 25 ], [ 45, 27 ], [ 14, 29 ], [ 47, 32 ], [ 48, 36 ], [ 42, 36 ], [ 38, 39 ], [ 41, 42 ], [ 44, 45 ], [ 47, 48 ] ]
[ "S = input()\nList = list(S)\ntrial = 0\nfor i in range(1,len(List)):\n if List[i] != List[i-1]:\n trial += 1\nprint(trial)", "S = input()", "S", "input()", "input", "List = list(S)", "List", "list(S)", "list", "S", "trial = 0", "trial", "0", "for i in range(1,len(List)):\n if List[i] != List[i-1]:\n trial += 1", "i", "range(1,len(List))", "range", "1", "len(List)", "len", "List", "if List[i] != List[i-1]:\n trial += 1", "List[i] != List[i-1]", "List[i]", "List", "i", "List[i-1]", "List", "i-1", "i", "1", "trial += 1", "trial", "1", "print(trial)", "print", "trial", "S = input()", "input()", "S", "trial = 0", "0", "trial", "List = list(S)", "list(S)", "List", "trial += 1", "1", "trial" ]
S = input() List = list(S) trial = 0 for i in range(1,len(List)): if List[i] != List[i-1]: trial += 1 print(trial)
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 17, 13, 10, 13, 13, 10, 17, 13, 10, 4, 13, 10, 18, 13 ]
[ [ 39, 2 ], [ 42, 6 ], [ 40, 8 ], [ 30, 11 ], [ 15, 14 ], [ 40, 14 ], [ 43, 18 ], [ 34, 18 ], [ 14, 19 ], [ 36, 21 ], [ 33, 24 ], [ 14, 25 ], [ 37, 28 ], [ 31, 28 ], [ 30, 31 ], [ 14, 33 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ] ]
[ "s=input()\nnow = s[0]\nres = 0\nfor char in s:\n if now != char:\n res += 1\n now = char\nprint(res)\n", "s=input()", "s", "input()", "input", "now = s[0]", "now", "s[0]", "s", "0", "res = 0", "res", "0", "for char in s:\n if now != char:\n res += 1\n now = char", "char", "s", "if now != char:\n res += 1\n ", "now != char", "now", "char", "res += 1", "res", "1", "now = char", "now", "char", "print(res)", "print", "res", "res = 0", "0", "res", "now = char", "char", "now", "res += 1", "1", "res", "s=input()", "input()", "s", "now = s[0]", "s[0]", "now" ]
s=input() now = s[0] res = 0 for char in s: if now != char: res += 1 now = char print(res)
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 18, 13, 10, 13, 13 ]
[ [ 36, 2 ], [ 39, 6 ], [ 37, 8 ], [ 30, 11 ], [ 15, 14 ], [ 37, 14 ], [ 14, 18 ], [ 40, 19 ], [ 43, 19 ], [ 33, 21 ], [ 42, 24 ], [ 14, 25 ], [ 34, 28 ], [ 31, 28 ], [ 30, 31 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 14, 42 ], [ 42, 43 ] ]
[ "S = input()\n\ncurrent = S[0]\nans = 0\nfor s in S:\n if s != current:\n ans += 1\n current = s\n\nprint(ans)", "S = input()", "S", "input()", "input", "current = S[0]", "current", "S[0]", "S", "0", "ans = 0", "ans", "0", "for s in S:\n if s != current:\n ans += 1\n current = s", "s", "S", "if s != current:\n ans += 1\n current = s", "s != current", "s", "current", "ans += 1", "ans", "1", "current = s", "current", "s", "print(ans)", "print", "ans", "ans = 0", "0", "ans", "ans += 1", "1", "ans", "S = input()", "input()", "S", "current = S[0]", "S[0]", "current", "current = s", "s", "current" ]
S = input() current = S[0] ans = 0 for s in S: if s != current: ans += 1 current = s print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 18, 13, 13, 17, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 28, 2 ], [ 25, 6 ], [ 29, 9 ], [ 31, 13 ], [ 29, 16 ], [ 26, 22 ], [ 32, 23 ], [ 25, 26 ], [ 28, 29 ], [ 31, 32 ] ]
[ "s=input()\nx=s.count(\"WB\")\ny=s.count(\"BW\")\nprint(x+y)", "s=input()", "s", "input()", "input", "x=s.count(\"WB\")", "x", "s.count(\"WB\")", "s.count", "s", "count", "\"WB\"", "y=s.count(\"BW\")", "y", "s.count(\"BW\")", "s.count", "s", "count", "\"BW\"", "print(x+y)", "print", "x+y", "x", "y", "x=s.count(\"WB\")", "s.count(\"WB\")", "x", "s=input()", "input()", "s", "y=s.count(\"BW\")", "s.count(\"BW\")", "y" ]
s=input() x=s.count("WB") y=s.count("BW") print(x+y)
[ 7, 0, 13, 4, 13, 4, 13, 4, 13, 40, 13, 13, 10, 4, 13 ]
[ [ 13, 2 ], [ 13, 14 ] ]
[ "S = input()\nprint(sum(a!=b for a,b in zip(S,S[1:])))", "S = input()", "S", "input()", "input", "print(sum(a!=b for a,b in zip(S,S[1:])))", "print", "sum(a!=b for a,b in zip(S,S[1:]))", "sum", "a!=b", "a", "b", "S = input()", "input()", "S" ]
S = input() print(sum(a!=b for a,b in zip(S,S[1:])))
[ 7, 15, 13, 0, 13, 4, 18, 13, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 13, 0, 13, 17, 4, 13, 2, 13, 17, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 31, 4 ], [ 34, 14 ], [ 18, 17 ], [ 32, 17 ], [ 28, 20 ], [ 29, 25 ], [ 35, 25 ], [ 28, 29 ], [ 31, 32 ], [ 34, 35 ] ]
[ "# ABC047 C 一次元リバーシ\n\nimport itertools\n\ns = itertools.groupby(list(input()))\n\nans = 0\nfor _ in s:\n ans += 1\n\nprint(ans - 1)", "import itertools", "itertools", "s = itertools.groupby(list(input()))", "s", "itertools.groupby(list(input()))", "itertools.groupby", "itertools", "groupby", "list(input())", "list", "input()", "input", "ans = 0", "ans", "0", "for _ in s:\n ans += 1", "_", "s", "ans += 1", "ans", "1", "print(ans - 1)", "print", "ans - 1", "ans", "1", "ans += 1", "1", "ans", "s = itertools.groupby(list(input()))", "itertools.groupby(list(input()))", "s", "ans = 0", "0", "ans" ]
# ABC047 C 一次元リバーシ import itertools s = itertools.groupby(list(input())) ans = 0 for _ in s: ans += 1 print(ans - 1)
[ 7, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 4, 18, 13, 13, 17, 0, 13, 18, 13, 13, 0, 13, 2, 2, 17, 17, 17, 0, 13, 12, 4, 13, 4, 18, 18, 13, 13, 13, 0, 13, 12, 4, 13, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 0, 13, 12, 4, 13, 4, 13, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 12, 13, 0, 13, 4, 13, 4, 18, 18, 13, 13, 13, 24, 18, 13, 2, 4, 13, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 4, 13, 17, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 2, 13, 10, 12, 13, 10, 12, 13, 10, 18, 13 ]
[ [ 157, 31 ], [ 148, 36 ], [ 154, 43 ], [ 142, 54 ], [ 151, 69 ], [ 89, 88 ], [ 88, 99 ], [ 88, 103 ], [ 107, 106 ], [ 110, 109 ], [ 88, 115 ], [ 88, 119 ], [ 109, 120 ], [ 88, 122 ], [ 109, 124 ], [ 128, 127 ], [ 127, 134 ], [ 106, 134 ], [ 146, 140 ], [ 142, 143 ], [ 148, 149 ], [ 151, 152 ], [ 154, 155 ], [ 157, 158 ] ]
[ "import sys\nimport re\nimport math\nimport collections\nimport decimal\nimport bisect\nimport itertools\nimport fractions\nimport functools\nimport copy\nimport heapq\nimport decimal\n\nsys.setrecursionlimit(10000001)\nINF = sys.maxsize\nMOD = 10 ** 9 + 7\n\nni = lambda: int(sys.stdin.readline())\nns = lambda: map(int, sys.stdin.readline().split())\nna = lambda: list(map(int, sys.stdin.readline().split()))\n\n\n# ===CODE===\ndef main():\n s = list(sys.stdin.readline())\n del s[len(s) - 1]\n cnt = 0\n\n for i in range(1, len(s)):\n if s[i] != s[i - 1]:\n cnt += 1\n\n print(max(0, cnt))\n\n\nif __name__ == '__main__':\n main()", "import sys", "sys", "import re", "re", "import math", "math", "import collections", "collections", "import decimal", "decimal", "import bisect", "bisect", "import itertools", "itertools", "import fractions", "fractions", "import functools", "functools", "import copy", "copy", "import heapq", "heapq", "import decimal", "decimal", "sys.setrecursionlimit(10000001)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10000001", "INF = sys.maxsize", "INF", "sys.maxsize", "sys", "maxsize", "MOD = 10 ** 9 + 7", "MOD", "10 ** 9 + 7", "10 ** 9", "10", "9", "7", "ni = lambda: int(sys.stdin.readline())", "ni", "lambda: int(sys.stdin.readline())", "int(sys.stdin.readline())", "int", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "ns = lambda: map(int, sys.stdin.readline().split())", "ns", "lambda: map(int, sys.stdin.readline().split())", "map(int, sys.stdin.readline().split())", "map", "int", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "na = lambda: list(map(int, sys.stdin.readline().split()))", "na", "lambda: list(map(int, sys.stdin.readline().split()))", "list(map(int, sys.stdin.readline().split()))", "list", "map(int, sys.stdin.readline().split())", "map", "int", "sys.stdin.readline().split()", "sys.stdin.readline().split", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "split", "def main():\n s = list(sys.stdin.readline())\n del s[len(s) - 1]\n cnt = 0\n\n for i in range(1, len(s)):\n if s[i] != s[i - 1]:\n cnt += 1\n\n print(max(0, cnt))", "main", "s = list(sys.stdin.readline())", "s", "list(sys.stdin.readline())", "list", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "del s[len(s) - 1]", "s[len(s) - 1]", "s", "len(s) - 1", "len(s)", "len", "s", "1", "cnt = 0", "cnt", "0", "for i in range(1, len(s)):\n if s[i] != s[i - 1]:\n cnt += 1\n\n ", "i", "range(1, len(s))", "range", "1", "len(s)", "len", "s", "if s[i] != s[i - 1]:\n cnt += 1\n\n ", "s[i] != s[i - 1]", "s[i]", "s", "i", "s[i - 1]", "s", "i - 1", "i", "1", "cnt += 1", "cnt", "1", "print(max(0, cnt))", "print", "max(0, cnt)", "max", "0", "cnt", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "ns = lambda: map(int, sys.stdin.readline().split())", "lambda: map(int, sys.stdin.readline().split())", "ns", "def main():\n s = list(sys.stdin.readline())\n del s[len(s) - 1]\n cnt = 0\n\n for i in range(1, len(s)):\n if s[i] != s[i - 1]:\n cnt += 1\n\n print(max(0, cnt))", "def main():\n s = list(sys.stdin.readline())\n del s[len(s) - 1]\n cnt = 0\n\n for i in range(1, len(s)):\n if s[i] != s[i - 1]:\n cnt += 1\n\n print(max(0, cnt))", "main", "MOD = 10 ** 9 + 7", "10 ** 9 + 7", "MOD", "na = lambda: list(map(int, sys.stdin.readline().split()))", "lambda: list(map(int, sys.stdin.readline().split()))", "na", "ni = lambda: int(sys.stdin.readline())", "lambda: int(sys.stdin.readline())", "ni", "INF = sys.maxsize", "sys.maxsize", "INF" ]
import sys import re import math import collections import decimal import bisect import itertools import fractions import functools import copy import heapq import decimal sys.setrecursionlimit(10000001) INF = sys.maxsize MOD = 10 ** 9 + 7 ni = lambda: int(sys.stdin.readline()) ns = lambda: map(int, sys.stdin.readline().split()) na = lambda: list(map(int, sys.stdin.readline().split())) # ===CODE=== def main(): s = list(sys.stdin.readline()) del s[len(s) - 1] cnt = 0 for i in range(1, len(s)): if s[i] != s[i - 1]: cnt += 1 print(max(0, cnt)) if __name__ == '__main__': main()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 18, 13, 39, 17, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 4, 13, 10, 18, 13, 10, 17, 13, 10, 13, 13, 10, 17, 13 ]
[ [ 33, 2 ], [ 39, 6 ], [ 36, 9 ], [ 34, 11 ], [ 15, 14 ], [ 34, 16 ], [ 14, 21 ], [ 37, 22 ], [ 43, 22 ], [ 45, 24 ], [ 42, 27 ], [ 14, 28 ], [ 46, 31 ], [ 40, 31 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 14, 42 ], [ 42, 43 ], [ 45, 46 ] ]
[ "s = input()\n\nans = 0\ntmp = s[0]\nfor x in s[1:]:\n if x != tmp:\n ans += 1\n tmp = x\n\nprint(ans)", "s = input()", "s", "input()", "input", "ans = 0", "ans", "0", "tmp = s[0]", "tmp", "s[0]", "s", "0", "for x in s[1:]:\n if x != tmp:\n ans += 1\n tmp = x", "x", "s[1:]", "s", "1:", "1", "if x != tmp:\n ans += 1\n tmp = x", "x != tmp", "x", "tmp", "ans += 1", "ans", "1", "tmp = x", "tmp", "x", "print(ans)", "print", "ans", "s = input()", "input()", "s", "tmp = s[0]", "s[0]", "tmp", "ans = 0", "0", "ans", "tmp = x", "x", "tmp", "ans += 1", "1", "ans" ]
s = input() ans = 0 tmp = s[0] for x in s[1:]: if x != tmp: ans += 1 tmp = x print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 13, 14, 2, 13, 13, 9, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 18, 13, 10, 13, 13 ]
[ [ 34, 2 ], [ 40, 6 ], [ 35, 8 ], [ 37, 11 ], [ 15, 14 ], [ 35, 14 ], [ 14, 18 ], [ 41, 19 ], [ 44, 19 ], [ 31, 22 ], [ 43, 25 ], [ 14, 26 ], [ 32, 29 ], [ 38, 29 ], [ 31, 32 ], [ 34, 35 ], [ 37, 38 ], [ 40, 41 ], [ 14, 43 ], [ 43, 44 ] ]
[ "s=input()\nc1=s[0]\nres=0\nfor c in s:\n if c==c1:\n continue\n else:\n res+=1\n c1=c\nprint(res)", "s=input()", "s", "input()", "input", "c1=s[0]", "c1", "s[0]", "s", "0", "res=0", "res", "0", "for c in s:\n if c==c1:\n continue\n else:\n res+=1\n c1=c", "c", "s", "if c==c1:\n continue\n else:\n res+=1\n c1=c", "c==c1", "c", "c1", "continue", "res+=1", "res", "1", "c1=c", "c1", "c", "print(res)", "print", "res", "res+=1", "1", "res", "s=input()", "input()", "s", "res=0", "0", "res", "c1=s[0]", "s[0]", "c1", "c1=c", "c", "c1" ]
s=input() c1=s[0] res=0 for c in s: if c==c1: continue else: res+=1 c1=c print(res)
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 39, 13, 28, 13, 18, 13, 39, 17, 14, 2, 13, 13, 4, 18, 13, 13, 13, 0, 13, 13, 4, 13, 2, 4, 13, 13, 17, 10, 4, 13, 10, 39, 13, 10, 13, 13, 10, 18, 13 ]
[ [ 40, 2 ], [ 49, 6 ], [ 41, 8 ], [ 43, 11 ], [ 16, 15 ], [ 41, 17 ], [ 50, 22 ], [ 47, 22 ], [ 15, 23 ], [ 44, 26 ], [ 15, 28 ], [ 46, 30 ], [ 15, 31 ], [ 44, 37 ], [ 40, 41 ], [ 43, 44 ], [ 15, 46 ], [ 46, 47 ], [ 49, 50 ] ]
[ "S = input()\nb = S[0]\nx = [b]\nfor s in S[1:]:\n if b == s: continue\n x.append(s)\n b = s\nprint(len(x)-1)", "S = input()", "S", "input()", "input", "b = S[0]", "b", "S[0]", "S", "0", "x = [b]", "x", "[b]", "b", "for s in S[1:]:\n if b == s: continue\n x.append(s)\n b = s", "s", "S[1:]", "S", "1:", "1", "if b == s: continue\n ", "b == s", "b", "s", "x.append(s)", "x.append", "x", "append", "s", "b = s", "b", "s", "print(len(x)-1)", "print", "len(x)-1", "len(x)", "len", "x", "1", "S = input()", "input()", "S", "x = [b]", "[b]", "x", "b = s", "s", "b", "b = S[0]", "S[0]", "b" ]
S = input() b = S[0] x = [b] for s in S[1:]: if b == s: continue x.append(s) b = s print(len(x)-1)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 13, 0, 13, 17, 4, 13, 2, 13, 17, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 13, 13 ]
[ [ 33, 2 ], [ 36, 6 ], [ 39, 9 ], [ 13, 12 ], [ 34, 12 ], [ 12, 16 ], [ 40, 17 ], [ 43, 17 ], [ 42, 19 ], [ 12, 20 ], [ 30, 22 ], [ 31, 27 ], [ 37, 27 ], [ 30, 31 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 12, 42 ], [ 42, 43 ] ]
[ "S = input()\ncount = 0\np = ''\nfor s in S:\n if s != p:\n p = s\n count += 1\nprint(count-1)", "S = input()", "S", "input()", "input", "count = 0", "count", "0", "p = ''", "p", "''", "for s in S:\n if s != p:\n p = s\n count += 1", "s", "S", "if s != p:\n p = s\n count += 1", "s != p", "s", "p", "p = s", "p", "s", "count += 1", "count", "1", "print(count-1)", "print", "count-1", "count", "1", "count += 1", "1", "count", "S = input()", "input()", "S", "count = 0", "0", "count", "p = ''", "''", "p", "p = s", "s", "p" ]
S = input() count = 0 p = '' for s in S: if s != p: p = s count += 1 print(count-1)
[ 7, 15, 13, 12, 13, 12, 13, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 13, 4, 13, 13, 14, 2, 13, 17, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 9, 8 ], [ 53, 10 ], [ 13, 12 ], [ 8, 14 ], [ 18, 17 ], [ 8, 24 ], [ 12, 32 ], [ 37, 32 ], [ 35, 34 ], [ 38, 37 ], [ 34, 41 ], [ 17, 41 ], [ 50, 47 ] ]
[ "import sys\ndef input(): return sys.stdin.readline().strip()\n\ndef main():\n S = input()\n pre = S[0]\n ans = 0\n for i, c in enumerate(S):\n if i == 0: continue\n if c != pre:\n ans += 1\n pre = c\n print(ans)\n\nif __name__ == \"__main__\":\n main()", "import sys", "sys", "def input(): return sys.stdin.readline().strip()", "input", "def main():\n S = input()\n pre = S[0]\n ans = 0\n for i, c in enumerate(S):\n if i == 0: continue\n if c != pre:\n ans += 1\n pre = c\n print(ans)", "main", "S = input()", "S", "input()", "input", "pre = S[0]", "pre", "S[0]", "S", "0", "ans = 0", "ans", "0", "for i, c in enumerate(S):\n if i == 0: continue\n if c != pre:\n ans += 1\n pre = c\n ", "i", "c", "enumerate(S)", "enumerate", "S", "if i == 0: continue\n ", "i == 0", "i", "0", "if c != pre:\n ans += 1\n pre = c\n ", "c != pre", "c", "pre", "ans += 1", "ans", "1", "pre = c", "pre", "c", "print(ans)", "print", "ans", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def main():\n S = input()\n pre = S[0]\n ans = 0\n for i, c in enumerate(S):\n if i == 0: continue\n if c != pre:\n ans += 1\n pre = c\n print(ans)", "def main():\n S = input()\n pre = S[0]\n ans = 0\n for i, c in enumerate(S):\n if i == 0: continue\n if c != pre:\n ans += 1\n pre = c\n print(ans)", "main", "def input(): return sys.stdin.readline().strip()", "def input(): return sys.stdin.readline().strip()", "input" ]
import sys def input(): return sys.stdin.readline().strip() def main(): S = input() pre = S[0] ans = 0 for i, c in enumerate(S): if i == 0: continue if c != pre: ans += 1 pre = c print(ans) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 14, 40, 17, 13, 4, 13, 17, 14, 40, 17, 13, 4, 13, 17, 14, 2, 18, 13, 17, 17, 0, 13, 4, 18, 13, 13, 17, 14, 2, 18, 13, 17, 17, 4, 13, 2, 13, 17, 4, 13, 2, 2, 13, 17, 17, 0, 13, 4, 18, 13, 13, 17, 14, 2, 18, 13, 17, 17, 4, 13, 2, 13, 17, 4, 13, 2, 2, 13, 17, 17, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 82, 2 ], [ 83, 8 ], [ 83, 15 ], [ 83, 22 ], [ 76, 26 ], [ 83, 29 ], [ 83, 35 ], [ 77, 41 ], [ 77, 47 ], [ 79, 51 ], [ 83, 54 ], [ 83, 60 ], [ 80, 66 ], [ 80, 72 ], [ 76, 77 ], [ 79, 80 ], [ 82, 83 ] ]
[ "S = input()\nif 'W' not in S:\n print(0)\nelif 'B' not in S:\n print(0)\nelse:\n if S[0] == 'B':\n count = S.count('BW')\n if S[-1] == 'B':\n print(count*2)\n else:\n print(count*2 - 1)\n else:\n count = S.count('WB')\n if S[-1] == 'W':\n print(count*2)\n else:\n print(count*2 - 1)", "S = input()", "S", "input()", "input", "if 'W' not in S:\n print(0)\nelif 'B' not in S:\n print(0)\nelse:\n if S[0] == 'B':\n count = S.count('BW')\n if S[-1] == 'B':\n print(count*2)\n else:\n print(count*2 - 1)\n else:\n count = S.count('WB')\n if S[-1] == 'W':\n print(count*2)\n else:\n print(count*2 - 1)", "'W' not in S", "'W'", "S", "print(0)", "print", "0", "elif 'B' not in S:\n print(0)", "'B' not in S", "'B'", "S", "print(0)", "print", "0", "if S[0] == 'B':\n count = S.count('BW')\n if S[-1] == 'B':\n print(count*2)\n else:\n print(count*2 - 1)\n else:\n count = S.count('WB')\n if S[-1] == 'W':\n print(count*2)\n else:\n print(count*2 - 1)", "S[0] == 'B'", "S[0]", "S", "0", "'B'", "count = S.count('BW')", "count", "S.count('BW')", "S.count", "S", "count", "'BW'", "if S[-1] == 'B':\n print(count*2)\n else:\n print(count*2 - 1)\n ", "S[-1] == 'B'", "S[-1]", "S", "-1", "'B'", "print(count*2)", "print", "count*2", "count", "2", "print(count*2 - 1)", "print", "count*2 - 1", "count*2", "count", "2", "1", "count = S.count('WB')", "count", "S.count('WB')", "S.count", "S", "count", "'WB'", "if S[-1] == 'W':\n print(count*2)\n else:\n print(count*2 - 1)", "S[-1] == 'W'", "S[-1]", "S", "-1", "'W'", "print(count*2)", "print", "count*2", "count", "2", "print(count*2 - 1)", "print", "count*2 - 1", "count*2", "count", "2", "1", "count = S.count('BW')", "S.count('BW')", "count", "count = S.count('WB')", "S.count('WB')", "count", "S = input()", "input()", "S" ]
S = input() if 'W' not in S: print(0) elif 'B' not in S: print(0) else: if S[0] == 'B': count = S.count('BW') if S[-1] == 'B': print(count*2) else: print(count*2 - 1) else: count = S.count('WB') if S[-1] == 'W': print(count*2) else: print(count*2 - 1)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 13, 0, 13, 40, 13, 13, 0, 13, 13, 4, 13, 13, 10, 18, 13, 10, 40, 13, 10, 13, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 40, 2 ], [ 37, 6 ], [ 28, 9 ], [ 41, 11 ], [ 15, 14 ], [ 41, 14 ], [ 31, 17 ], [ 29, 19 ], [ 35, 19 ], [ 14, 20 ], [ 34, 22 ], [ 14, 23 ], [ 32, 26 ], [ 38, 26 ], [ 28, 29 ], [ 31, 32 ], [ 14, 34 ], [ 34, 35 ], [ 37, 38 ], [ 40, 41 ] ]
[ "s = input()\nans = 0\np = s[0]\nfor si in s:\n ans += p != si\n p = si\nprint(ans)", "s = input()", "s", "input()", "input", "ans = 0", "ans", "0", "p = s[0]", "p", "s[0]", "s", "0", "for si in s:\n ans += p != si\n p = si", "si", "s", "ans += p != si", "ans", "p != si", "p", "si", "p = si", "p", "si", "print(ans)", "print", "ans", "p = s[0]", "s[0]", "p", "ans += p != si", "p != si", "ans", "p = si", "si", "p", "ans = 0", "0", "ans", "s = input()", "input()", "s" ]
s = input() ans = 0 p = s[0] for si in s: ans += p != si p = si print(ans)
[ 7, 15, 0, 13, 4, 13, 0, 13, 4, 13, 13, 41, 28, 13, 13, 13, 4, 4, 13, 4, 13, 13, 0, 13, 13, 4, 13, 2, 4, 13, 13, 17, 10, 13, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 39, 3 ], [ 36, 7 ], [ 40, 10 ], [ 33, 23 ], [ 34, 30 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ] ]
[ "from itertools import groupby\n\nS=input()\nG=groupby(S)\ng=[len(list(i)) for i,_ in G]\nprint(sum(g)-1)", "from itertools import groupby", "S=input()", "S", "input()", "input", "G=groupby(S)", "G", "groupby(S)", "groupby", "S", "len(list(i)) for i,_ in G", "for i,_ in G", "i", "_", "G", "for i,_ in G", "len(list(i))", "len", "list(i)", "list", "i", "g=[len(list(i)) for i,_ in G]", "g", "[len(list(i)) for i,_ in G]", "print(sum(g)-1)", "print", "sum(g)-1", "sum(g)", "sum", "g", "1", "g=[len(list(i)) for i,_ in G]", "[len(list(i)) for i,_ in G]", "g", "G=groupby(S)", "groupby(S)", "G", "S=input()", "input()", "S" ]
from itertools import groupby S=input() G=groupby(S) g=[len(list(i)) for i,_ in G] print(sum(g)-1)
[ 7, 17, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 2, 18, 13, 13, 13, 9, 0, 13, 17, 0, 13, 18, 13, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 2, 4, 13, 13, 17, 17, 17, 14, 2, 18, 13, 13, 13, 9, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 4, 13, 13, 13, 10, 17, 13, 10, 4, 13, 10, 18, 13, 10, 18, 13, 10, 18, 13, 10, 17, 13, 10, 17, 13, 10, 18, 13, 10, 17, 13 ]
[ [ 81, 3 ], [ 84, 7 ], [ 82, 9 ], [ 102, 12 ], [ 16, 15 ], [ 82, 21 ], [ 82, 25 ], [ 15, 26 ], [ 85, 27 ], [ 100, 27 ], [ 93, 30 ], [ 99, 33 ], [ 82, 35 ], [ 15, 36 ], [ 87, 38 ], [ 82, 40 ], [ 96, 43 ], [ 47, 46 ], [ 82, 52 ], [ 82, 59 ], [ 46, 60 ], [ 88, 61 ], [ 100, 61 ], [ 85, 61 ], [ 91, 61 ], [ 78, 64 ], [ 90, 67 ], [ 82, 69 ], [ 46, 70 ], [ 94, 75 ], [ 103, 75 ], [ 79, 76 ], [ 97, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ], [ 90, 91 ], [ 93, 94 ], [ 96, 97 ], [ 99, 100 ], [ 102, 103 ] ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu May 14 18:16:23 2020\n\n@author: shinba\n\"\"\"\n\ns = input()\n\nstart = s[0]\ncnt1 = 0\n\nfor i in range(1,len(s)):\n if s[i] == start:\n continue\n cnt1 += 1\n start = s[i]\n\nstart = s[-1]\ncnt2 = 0\n\nfor i in range(len(s)-1,-1,-1):\n if s[i] == start:\n continue\n cnt2 += 1\n start = s[i]\n\nprint(min(cnt1,cnt2))", "\"\"\"\nCreated on Thu May 14 18:16:23 2020\n\n@author: shinba\n\"\"\"", "s = input()", "s", "input()", "input", "start = s[0]", "start", "s[0]", "s", "0", "cnt1 = 0", "cnt1", "0", "for i in range(1,len(s)):\n if s[i] == start:\n continue\n cnt1 += 1\n start = s[i]", "i", "range(1,len(s))", "range", "1", "len(s)", "len", "s", "if s[i] == start:\n continue\n ", "s[i] == start", "s[i]", "s", "i", "start", "continue", "cnt1 += 1", "cnt1", "1", "start = s[i]", "start", "s[i]", "s", "i", "start = s[-1]", "start", "s[-1]", "s", "-1", "cnt2 = 0", "cnt2", "0", "for i in range(len(s)-1,-1,-1):\n if s[i] == start:\n continue\n cnt2 += 1\n start = s[i]", "i", "range(len(s)-1,-1,-1)", "range", "len(s)-1", "len(s)", "len", "s", "1", "-1", "-1", "if s[i] == start:\n continue\n ", "s[i] == start", "s[i]", "s", "i", "start", "continue", "cnt2 += 1", "cnt2", "1", "start = s[i]", "start", "s[i]", "s", "i", "print(min(cnt1,cnt2))", "print", "min(cnt1,cnt2)", "min", "cnt1", "cnt2", "cnt2 += 1", "1", "cnt2", "s = input()", "input()", "s", "start = s[0]", "s[0]", "start", "start = s[-1]", "s[-1]", "start", "start = s[i]", "s[i]", "start", "cnt1 += 1", "1", "cnt1", "cnt2 = 0", "0", "cnt2", "start = s[i]", "s[i]", "start", "cnt1 = 0", "0", "cnt1" ]
# -*- coding: utf-8 -*- """ Created on Thu May 14 18:16:23 2020 @author: shinba """ s = input() start = s[0] cnt1 = 0 for i in range(1,len(s)): if s[i] == start: continue cnt1 += 1 start = s[i] start = s[-1] cnt2 = 0 for i in range(len(s)-1,-1,-1): if s[i] == start: continue cnt2 += 1 start = s[i] print(min(cnt1,cnt2))
[ 7, 0, 13, 4, 13, 14, 2, 18, 13, 17, 17, 0, 13, 17, 0, 13, 17, 14, 2, 13, 2, 18, 13, 17, 4, 13, 13, 4, 13, 17, 4, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 2, 4, 13, 13, 17, 14, 2, 18, 13, 13, 13, 0, 13, 17, 14, 2, 13, 17, 0, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 78, 2 ], [ 79, 8 ], [ 84, 12 ], [ 81, 15 ], [ 79, 19 ], [ 79, 22 ], [ 79, 26 ], [ 75, 33 ], [ 37, 36 ], [ 79, 44 ], [ 79, 49 ], [ 36, 50 ], [ 82, 51 ], [ 85, 51 ], [ 88, 51 ], [ 73, 51 ], [ 69, 53 ], [ 82, 57 ], [ 85, 57 ], [ 88, 57 ], [ 73, 57 ], [ 72, 60 ], [ 87, 63 ], [ 70, 67 ], [ 76, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ], [ 87, 88 ] ]
[ "s = input()\n\nif s[-1] == 'B':\n new = 'W'\nelse:\n new = 'B'\n\nif s == s[0] * len(s):\n print(0)\n exit()\n\nans = 0\nfor i in reversed(range(len(s)-1)):\n if s[i] == new:\n ans += 1\n if new == 'B':\n new = 'W'\n else:\n new = 'B'\nprint(ans)", "s = input()", "s", "input()", "input", "if s[-1] == 'B':\n new = 'W'\nelse:\n new = 'B'", "s[-1] == 'B'", "s[-1]", "s", "-1", "'B'", "new = 'W'", "new", "'W'", "new = 'B'", "new", "'B'", "if s == s[0] * len(s):\n print(0)\n exit()", "s == s[0] * len(s)", "s", "s[0] * len(s)", "s[0]", "s", "0", "len(s)", "len", "s", "print(0)", "print", "0", "exit()", "exit", "ans = 0", "ans", "0", "for i in reversed(range(len(s)-1)):\n if s[i] == new:\n ans += 1\n if new == 'B':\n new = 'W'\n else:\n new = 'B'", "i", "reversed(range(len(s)-1))", "reversed", "range(len(s)-1)", "range", "len(s)-1", "len(s)", "len", "s", "1", "if s[i] == new:\n ans += 1\n if new == 'B':\n new = 'W'\n else:\n new = 'B'", "s[i] == new", "s[i]", "s", "i", "new", "ans += 1", "ans", "1", "if new == 'B':\n new = 'W'\n else:\n new = 'B'", "new == 'B'", "new", "'B'", "new = 'W'", "new", "'W'", "new = 'B'", "new", "'B'", "print(ans)", "print", "ans", "ans += 1", "1", "ans", "new = 'W'", "'W'", "new", "ans = 0", "0", "ans", "s = input()", "input()", "s", "new = 'B'", "'B'", "new", "new = 'W'", "'W'", "new", "new = 'B'", "'B'", "new" ]
s = input() if s[-1] == 'B': new = 'W' else: new = 'B' if s == s[0] * len(s): print(0) exit() ans = 0 for i in reversed(range(len(s)-1)): if s[i] == new: ans += 1 if new == 'B': new = 'W' else: new = 'B' print(ans)
[ 7, 15, 13, 12, 13, 0, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 0, 13, 18, 13, 17, 13, 17, 28, 13, 13, 14, 40, 13, 13, 4, 13, 13, 14, 2, 13, 17, 10, 12, 13 ]
[ [ 7, 6 ], [ 18, 17 ], [ 6, 19 ], [ 22, 21 ], [ 25, 24 ], [ 6, 24 ], [ 17, 28 ], [ 24, 29 ], [ 21, 32 ] ]
[ "import sys\ndef v():\n S=sys.stdin.readline().strip()\n c,res=S[0],0\n for s in S:\n if c!=s:c,res=s,res+1\n print(res)\nif __name__=='__main__':v()", "import sys", "sys", "def v():\n S=sys.stdin.readline().strip()\n c,res=S[0],0\n for s in S:\n if c!=s:c,res=s,res+1\n print(res)", "v", "S=sys.stdin.readline().strip()", "S", "sys.stdin.readline().strip()", "sys.stdin.readline().strip", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "strip", "c,res=S[0],0", "c", "S[0]", "S", "0", "res", "0", "for s in S:\n if c!=s:c,res=s,res+1\n ", "s", "S", "if c!=s:c,res=s,res+1\n ", "c!=s", "c", "s", "print(res)", "print", "res", "if __name__=='__main__':v()", "__name__=='__main__'", "__name__", "'__main__'", "def v():\n S=sys.stdin.readline().strip()\n c,res=S[0],0\n for s in S:\n if c!=s:c,res=s,res+1\n print(res)", "def v():\n S=sys.stdin.readline().strip()\n c,res=S[0],0\n for s in S:\n if c!=s:c,res=s,res+1\n print(res)", "v" ]
import sys def v(): S=sys.stdin.readline().strip() c,res=S[0],0 for s in S: if c!=s:c,res=s,res+1 print(res) if __name__=='__main__':v()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 13, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 13, 13, 10, 17, 13 ]
[ [ 28, 2 ], [ 40, 6 ], [ 31, 9 ], [ 13, 12 ], [ 29, 12 ], [ 32, 16 ], [ 38, 16 ], [ 12, 17 ], [ 37, 19 ], [ 12, 20 ], [ 34, 22 ], [ 35, 26 ], [ 41, 26 ], [ 28, 29 ], [ 31, 32 ], [ 34, 35 ], [ 12, 37 ], [ 37, 38 ], [ 40, 41 ] ]
[ "S = input()\nresult = -1\npiyo = \"\"\nfor s in S:\n if piyo != s:\n piyo = s\n result += 1\nprint(result)", "S = input()", "S", "input()", "input", "result = -1", "result", "-1", "piyo = \"\"", "piyo", "\"\"", "for s in S:\n if piyo != s:\n piyo = s\n result += 1", "s", "S", "if piyo != s:\n piyo = s\n result += 1", "piyo != s", "piyo", "s", "piyo = s", "piyo", "s", "result += 1", "result", "1", "print(result)", "print", "result", "S = input()", "input()", "S", "piyo = \"\"", "\"\"", "piyo", "result += 1", "1", "result", "piyo = s", "s", "piyo", "result = -1", "-1", "result" ]
S = input() result = -1 piyo = "" for s in S: if piyo != s: piyo = s result += 1 print(result)
[ 7, 15, 13, 0, 13, 18, 18, 13, 13, 13, 0, 13, 18, 18, 13, 13, 13, 0, 13, 18, 18, 13, 13, 13, 12, 13, 0, 13, 4, 18, 4, 13, 13, 0, 13, 4, 13, 13, 0, 13, 39, 17, 28, 13, 4, 13, 2, 13, 17, 14, 2, 18, 13, 2, 13, 17, 18, 13, 13, 0, 18, 13, 17, 17, 4, 18, 13, 13, 17, 0, 13, 2, 4, 13, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 18, 13, 10, 12, 13, 10, 18, 13, 10, 18, 13 ]
[ [ 92, 4 ], [ 86, 11 ], [ 95, 18 ], [ 28, 27 ], [ 87, 31 ], [ 35, 34 ], [ 27, 37 ], [ 40, 39 ], [ 44, 43 ], [ 34, 47 ], [ 27, 52 ], [ 43, 54 ], [ 27, 57 ], [ 43, 58 ], [ 63, 60 ], [ 39, 61 ], [ 39, 66 ], [ 71, 70 ], [ 39, 74 ], [ 70, 78 ], [ 90, 84 ], [ 86, 87 ], [ 92, 93 ], [ 95, 96 ] ]
[ "import sys\nread = sys.stdin.read\nreadline = sys.stdin.readline\nreadlines = sys.stdin.readlines\n\ndef main():\n S = readline().strip()\n N = len(S)\n\n seq = [1]\n for i in range(N-1):\n if S[i+1] == S[i]:\n seq[-1] += 1\n else:\n seq.append(1)\n \n ans = len(seq) - 1\n print(ans)\n\n\n\nif __name__ == \"__main__\":\n main()", "import sys", "sys", "read = sys.stdin.read", "read", "sys.stdin.read", "sys.stdin", "sys", "stdin", "read", "readline = sys.stdin.readline", "readline", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "readlines = sys.stdin.readlines", "readlines", "sys.stdin.readlines", "sys.stdin", "sys", "stdin", "readlines", "def main():\n S = readline().strip()\n N = len(S)\n\n seq = [1]\n for i in range(N-1):\n if S[i+1] == S[i]:\n seq[-1] += 1\n else:\n seq.append(1)\n \n ans = len(seq) - 1\n print(ans)", "main", "S = readline().strip()", "S", "readline().strip()", "().strip", "()", "readline", "strip", "N = len(S)", "N", "len(S)", "len", "S", "seq = [1]", "seq", "[1]", "1", "for i in range(N-1):\n if S[i+1] == S[i]:\n seq[-1] += 1\n else:\n seq.append(1)\n \n ", "i", "range(N-1)", "range", "N-1", "N", "1", "if S[i+1] == S[i]:\n seq[-1] += 1\n else:\n seq.append(1)\n \n ", "S[i+1] == S[i]", "S[i+1]", "S", "i+1", "i", "1", "S[i]", "S", "i", "seq[-1] += 1", "seq[-1]", "seq", "-1", "1", "seq.append(1)", "seq.append", "seq", "append", "1", "ans = len(seq) - 1", "ans", "len(seq) - 1", "len(seq)", "len", "seq", "1", "print(ans)", "print", "ans", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "readline = sys.stdin.readline", "sys.stdin.readline", "readline", "def main():\n S = readline().strip()\n N = len(S)\n\n seq = [1]\n for i in range(N-1):\n if S[i+1] == S[i]:\n seq[-1] += 1\n else:\n seq.append(1)\n \n ans = len(seq) - 1\n print(ans)", "def main():\n S = readline().strip()\n N = len(S)\n\n seq = [1]\n for i in range(N-1):\n if S[i+1] == S[i]:\n seq[-1] += 1\n else:\n seq.append(1)\n \n ans = len(seq) - 1\n print(ans)", "main", "read = sys.stdin.read", "sys.stdin.read", "read", "readlines = sys.stdin.readlines", "sys.stdin.readlines", "readlines" ]
import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines def main(): S = readline().strip() N = len(S) seq = [1] for i in range(N-1): if S[i+1] == S[i]: seq[-1] += 1 else: seq.append(1) ans = len(seq) - 1 print(ans) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 0, 13, 4, 18, 13, 13, 17, 0, 13, 4, 18, 13, 13, 17, 4, 13, 2, 13, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 28, 2 ], [ 31, 6 ], [ 29, 9 ], [ 25, 13 ], [ 29, 16 ], [ 32, 22 ], [ 26, 23 ], [ 25, 26 ], [ 28, 29 ], [ 31, 32 ] ]
[ "\ns=input()\na=s.count('BW')\nb=s.count('WB')\n\nprint(a+b)", "s=input()", "s", "input()", "input", "a=s.count('BW')", "a", "s.count('BW')", "s.count", "s", "count", "'BW'", "b=s.count('WB')", "b", "s.count('WB')", "s.count", "s", "count", "'WB'", "print(a+b)", "print", "a+b", "a", "b", "b=s.count('WB')", "s.count('WB')", "b", "s=input()", "input()", "s", "a=s.count('BW')", "s.count('BW')", "a" ]
s=input() a=s.count('BW') b=s.count('WB') print(a+b)
[ 7, 15, 0, 13, 4, 13, 41, 28, 13, 13, 4, 13, 13, 4, 13, 0, 13, 13, 4, 13, 2, 4, 13, 13, 17, 10, 13, 13, 10, 4, 13 ]
[ [ 29, 3 ], [ 30, 12 ], [ 26, 16 ], [ 27, 23 ], [ 26, 27 ], [ 29, 30 ] ]
[ "# BWBWB と BWWBBBBWWWWWWBBBBB を一色にする手順は同じ。\nfrom itertools import groupby\n\nS = input()\ngrp = [k for k, _ in groupby(S)]\nprint(len(grp) - 1)", "from itertools import groupby", "S = input()", "S", "input()", "input", "k for k, _ in groupby(S)", "for k, _ in groupby(S)", "k", "_", "groupby(S)", "groupby", "S", "for k, _ in groupby(S)", "k", "grp = [k for k, _ in groupby(S)]", "grp", "[k for k, _ in groupby(S)]", "print(len(grp) - 1)", "print", "len(grp) - 1", "len(grp)", "len", "grp", "1", "grp = [k for k, _ in groupby(S)]", "[k for k, _ in groupby(S)]", "grp", "S = input()", "input()", "S" ]
# BWBWB と BWWBBBBWWWWWWBBBBB を一色にする手順は同じ。 from itertools import groupby S = input() grp = [k for k, _ in groupby(S)] print(len(grp) - 1)
[ 7, 15, 13, 13, 13, 13, 15, 15, 15, 15, 13, 4, 18, 13, 13, 2, 17, 17, 12, 13, 12, 13, 12, 13, 12, 13, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 17, 13, 10, 12, 13, 10, 17, 13 ]
[ [ 58, 27 ], [ 62, 29 ], [ 70, 31 ], [ 35, 34 ], [ 59, 40 ], [ 59, 44 ], [ 34, 45 ], [ 59, 47 ], [ 34, 49 ], [ 76, 52 ], [ 77, 56 ], [ 71, 56 ], [ 58, 59 ], [ 70, 71 ], [ 76, 77 ] ]
[ "import bisect,copy,heapq,string\nfrom collections import *\nfrom math import *\nfrom itertools import *\nimport sys\nsys.setrecursionlimit(10 ** 6)\ndef input() : return sys.stdin.readline().strip()\ndef INT() : return int(input())\ndef MAP() : return map(int,input().split())\ndef LIST() : return list(MAP())\n\ns = input()\n\nans = 0\nfor i in range(1,len(s)):\n if s[i] != s[i-1]:\n ans += 1\n\nprint(ans)", "import bisect,copy,heapq,string", "bisect", "copy", "heapq", "string", "from collections import *", "from math import *", "from itertools import *", "import sys", "sys", "sys.setrecursionlimit(10 ** 6)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 6", "10", "6", "def input() : return sys.stdin.readline().strip()", "input", "def INT() : return int(input())", "INT", "def MAP() : return map(int,input().split())", "MAP", "def LIST() : return list(MAP())", "LIST", "s = input()", "s", "input()", "input", "ans = 0", "ans", "0", "for i in range(1,len(s)):\n if s[i] != s[i-1]:\n ans += 1", "i", "range(1,len(s))", "range", "1", "len(s)", "len", "s", "if s[i] != s[i-1]:\n ans += 1", "s[i] != s[i-1]", "s[i]", "s", "i", "s[i-1]", "s", "i-1", "i", "1", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "s = input()", "input()", "s", "def input() : return sys.stdin.readline().strip()", "def input() : return sys.stdin.readline().strip()", "input", "def LIST() : return list(MAP())", "def LIST() : return list(MAP())", "LIST", "def INT() : return int(input())", "def INT() : return int(input())", "INT", "ans = 0", "0", "ans", "def MAP() : return map(int,input().split())", "def MAP() : return map(int,input().split())", "MAP", "ans += 1", "1", "ans" ]
import bisect,copy,heapq,string from collections import * from math import * from itertools import * import sys sys.setrecursionlimit(10 ** 6) def input() : return sys.stdin.readline().strip() def INT() : return int(input()) def MAP() : return map(int,input().split()) def LIST() : return list(MAP()) s = input() ans = 0 for i in range(1,len(s)): if s[i] != s[i-1]: ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 18, 13, 39, 17, 14, 40, 13, 13, 0, 13, 13, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 18, 13, 10, 13, 13, 10, 17, 13 ]
[ [ 33, 2 ], [ 36, 6 ], [ 39, 9 ], [ 34, 11 ], [ 15, 14 ], [ 34, 16 ], [ 40, 21 ], [ 43, 21 ], [ 14, 22 ], [ 42, 24 ], [ 14, 25 ], [ 45, 27 ], [ 46, 31 ], [ 37, 31 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 14, 42 ], [ 42, 43 ], [ 45, 46 ] ]
[ "s=input()\nc=0\nt=s[0]\nfor k in s[1:]:\n if t!=k:\n t=k\n c+=1\nprint(c)", "s=input()", "s", "input()", "input", "c=0", "c", "0", "t=s[0]", "t", "s[0]", "s", "0", "for k in s[1:]:\n if t!=k:\n t=k\n c+=1", "k", "s[1:]", "s", "1:", "1", "if t!=k:\n t=k\n c+=1", "t!=k", "t", "k", "t=k", "t", "k", "c+=1", "c", "1", "print(c)", "print", "c", "s=input()", "input()", "s", "c=0", "0", "c", "t=s[0]", "s[0]", "t", "t=k", "k", "t", "c+=1", "1", "c" ]
s=input() c=0 t=s[0] for k in s[1:]: if t!=k: t=k c+=1 print(c)
[ 7, 15, 13, 15, 13, 15, 13, 15, 13, 15, 4, 18, 13, 13, 2, 17, 17, 0, 13, 12, 4, 13, 2, 13, 17, 23, 0, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 2, 4, 13, 13, 17, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 12, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 61, 18 ], [ 70, 27 ], [ 64, 33 ], [ 37, 36 ], [ 71, 42 ], [ 71, 47 ], [ 36, 48 ], [ 71, 50 ], [ 36, 52 ], [ 67, 55 ], [ 68, 59 ], [ 65, 59 ], [ 61, 62 ], [ 64, 65 ], [ 67, 68 ], [ 70, 71 ] ]
[ "import collections\nimport numpy as np\nimport sys\nimport copy\nfrom functools import lru_cache\nsys.setrecursionlimit(10**8)\n#N,K=map(int,input().split())\n#N=int(input())\n#h=np.array(list(map(int,input().split())))\n#ans=0\nnum2alpha = lambda c: chr(c+96)\ns=list(input())\nans=0\nfor i in range(len(s)-1):\n if s[i]!=s[i+1]:\n ans+=1\nprint(ans)", "import collections", "collections", "import numpy as np", "numpy", "import sys", "sys", "import copy", "copy", "from functools import lru_cache", "sys.setrecursionlimit(10**8)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**8", "10", "8", "num2alpha = lambda c: chr(c+96)", "num2alpha", "lambda c: chr(c+96)", "chr(c+96)", "chr", "c+96", "c", "96", "c", "s=list(input())", "s", "list(input())", "list", "input()", "input", "ans=0", "ans", "0", "for i in range(len(s)-1):\n if s[i]!=s[i+1]:\n ans+=1", "i", "range(len(s)-1)", "range", "len(s)-1", "len(s)", "len", "s", "1", "if s[i]!=s[i+1]:\n ans+=1", "s[i]!=s[i+1]", "s[i]", "s", "i", "s[i+1]", "s", "i+1", "i", "1", "ans+=1", "ans", "1", "print(ans)", "print", "ans", "num2alpha = lambda c: chr(c+96)", "lambda c: chr(c+96)", "num2alpha", "ans=0", "0", "ans", "ans+=1", "1", "ans", "s=list(input())", "list(input())", "s" ]
import collections import numpy as np import sys import copy from functools import lru_cache sys.setrecursionlimit(10**8) #N,K=map(int,input().split()) #N=int(input()) #h=np.array(list(map(int,input().split()))) #ans=0 num2alpha = lambda c: chr(c+96) s=list(input()) ans=0 for i in range(len(s)-1): if s[i]!=s[i+1]: ans+=1 print(ans)
[ 7, 15, 13, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 12, 13, 12, 13, 0, 13, 4, 13, 17, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 28, 13, 4, 13, 2, 13, 17, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 12, 13, 10, 17, 13, 10, 4, 13, 10, 12, 13, 10, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 4, 13, 10, 17, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 12, 11 ], [ 112, 17 ], [ 21, 21 ], [ 25, 24 ], [ 109, 30 ], [ 34, 34 ], [ 38, 37 ], [ 47, 47 ], [ 117, 53 ], [ 105, 58 ], [ 130, 60 ], [ 99, 62 ], [ 106, 65 ], [ 96, 67 ], [ 71, 70 ], [ 100, 74 ], [ 106, 79 ], [ 70, 80 ], [ 106, 82 ], [ 70, 84 ], [ 120, 87 ], [ 121, 91 ], [ 97, 91 ], [ 96, 97 ], [ 99, 100 ], [ 105, 106 ], [ 117, 118 ], [ 120, 121 ] ]
[ "import sys\n\n\ndef input(): return sys.stdin.readline().strip()\ndef I(): return int(input())\ndef LI(): return list(map(int, input().split()))\ndef IR(n): return [I() for i in range(n)]\ndef LIR(n): return [LI() for i in range(n)]\ndef SR(n): return [S() for i in range(n)]\ndef S(): return input()\ndef LS(): return input().split()\n\n\nINF = float('inf')\n\ns = S()\nn = len(s)\nans = 0\nfor i in range(n - 1):\n if s[i] != s[i + 1]:\n ans += 1\nprint(ans)", "import sys", "sys", "def input(): return sys.stdin.readline().strip()", "input", "def I(): return int(input())", "I", "def LI(): return list(map(int, input().split()))", "LI", "I() for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "I()", "I", "def IR(n): return [I() for i in range(n)]", "IR", "n", "n", "LI() for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "LI()", "LI", "def LIR(n): return [LI() for i in range(n)]", "LIR", "n", "n", "S() for i in range(n)", "for i in range(n)", "i", "range(n)", "range", "n", "for i in range(n)", "S()", "S", "def SR(n): return [S() for i in range(n)]", "SR", "n", "n", "def S(): return input()", "S", "def LS(): return input().split()", "LS", "INF = float('inf')", "INF", "float('inf')", "float", "'inf'", "s = S()", "s", "S()", "S", "n = len(s)", "n", "len(s)", "len", "s", "ans = 0", "ans", "0", "for i in range(n - 1):\n if s[i] != s[i + 1]:\n ans += 1", "i", "range(n - 1)", "range", "n - 1", "n", "1", "if s[i] != s[i + 1]:\n ans += 1", "s[i] != s[i + 1]", "s[i]", "s", "i", "s[i + 1]", "s", "i + 1", "i", "1", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "def IR(n): return [I() for i in range(n)]", "def IR(n): return [I() for i in range(n)]", "IR", "ans = 0", "0", "ans", "n = len(s)", "len(s)", "n", "def LIR(n): return [LI() for i in range(n)]", "def LIR(n): return [LI() for i in range(n)]", "LIR", "s = S()", "S()", "s", "def LI(): return list(map(int, input().split()))", "def LI(): return list(map(int, input().split()))", "LI", "def I(): return int(input())", "def I(): return int(input())", "I", "def LS(): return input().split()", "def LS(): return input().split()", "LS", "INF = float('inf')", "float('inf')", "INF", "ans += 1", "1", "ans", "def SR(n): return [S() for i in range(n)]", "def SR(n): return [S() for i in range(n)]", "SR", "def input(): return sys.stdin.readline().strip()", "def input(): return sys.stdin.readline().strip()", "input", "def S(): return input()", "def S(): return input()", "S" ]
import sys def input(): return sys.stdin.readline().strip() def I(): return int(input()) def LI(): return list(map(int, input().split())) def IR(n): return [I() for i in range(n)] def LIR(n): return [LI() for i in range(n)] def SR(n): return [S() for i in range(n)] def S(): return input() def LS(): return input().split() INF = float('inf') s = S() n = len(s) ans = 0 for i in range(n - 1): if s[i] != s[i + 1]: ans += 1 print(ans)
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 17, 28, 13, 13, 4, 13, 13, 14, 2, 13, 17, 0, 13, 13, 9, 14, 2, 13, 13, 9, 0, 13, 17, 0, 13, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 4, 15 ], [ 22, 21 ], [ 21, 26 ], [ 33, 26 ], [ 31, 30 ], [ 34, 33 ], [ 30, 37 ], [ 8, 37 ], [ 46, 43 ] ]
[ "def main():\n S = input()\n ans = 0\n for i, s in enumerate(S):\n if i == 0:\n t = s\n continue\n if t == s:\n continue\n else:\n ans += 1\n t = s\n print(ans)\n \nif __name__ == \"__main__\":\n main()", "def main():\n S = input()\n ans = 0\n for i, s in enumerate(S):\n if i == 0:\n t = s\n continue\n if t == s:\n continue\n else:\n ans += 1\n t = s\n print(ans)\n ", "main", "S = input()", "S", "input()", "input", "ans = 0", "ans", "0", "for i, s in enumerate(S):\n if i == 0:\n t = s\n continue\n if t == s:\n continue\n else:\n ans += 1\n t = s\n ", "i", "s", "enumerate(S)", "enumerate", "S", "if i == 0:\n t = s\n continue\n ", "i == 0", "i", "0", "t = s", "t", "s", "continue", "if t == s:\n continue\n else:\n ans += 1\n t = s\n ", "t == s", "t", "s", "continue", "ans += 1", "ans", "1", "t = s", "t", "s", "print(ans)", "print", "ans", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def main():\n S = input()\n ans = 0\n for i, s in enumerate(S):\n if i == 0:\n t = s\n continue\n if t == s:\n continue\n else:\n ans += 1\n t = s\n print(ans)\n ", "def main():\n S = input()\n ans = 0\n for i, s in enumerate(S):\n if i == 0:\n t = s\n continue\n if t == s:\n continue\n else:\n ans += 1\n t = s\n print(ans)\n ", "main" ]
def main(): S = input() ans = 0 for i, s in enumerate(S): if i == 0: t = s continue if t == s: continue else: ans += 1 t = s print(ans) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 18, 13, 39, 17, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 13, 13, 10, 18, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 45, 2 ], [ 39, 6 ], [ 36, 9 ], [ 46, 11 ], [ 15, 14 ], [ 46, 16 ], [ 14, 21 ], [ 37, 22 ], [ 34, 22 ], [ 42, 24 ], [ 33, 27 ], [ 14, 28 ], [ 43, 31 ], [ 40, 31 ], [ 14, 33 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ], [ 45, 46 ] ]
[ "S = input()\ncount = 0\nstate = S[0]\nfor i in S[1:]:\n if i != state:\n count += 1\n state = i\nprint(count)", "S = input()", "S", "input()", "input", "count = 0", "count", "0", "state = S[0]", "state", "S[0]", "S", "0", "for i in S[1:]:\n if i != state:\n count += 1\n state = i", "i", "S[1:]", "S", "1:", "1", "if i != state:\n count += 1\n state = i", "i != state", "i", "state", "count += 1", "count", "1", "state = i", "state", "i", "print(count)", "print", "count", "state = i", "i", "state", "state = S[0]", "S[0]", "state", "count = 0", "0", "count", "count += 1", "1", "count", "S = input()", "input()", "S" ]
S = input() count = 0 state = S[0] for i in S[1:]: if i != state: count += 1 state = i print(count)
[ 7, 15, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 12, 2, 4, 13, 13, 17, 23, 0, 13, 12, 4, 13, 31, 13, 0, 13, 17, 23, 12, 13, 12, 13, 12, 13, 41, 28, 13, 4, 13, 13, 4, 4, 13, 12, 13, 23, 13, 12, 13, 12, 13, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 2, 4, 13, 13, 17, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 4, 13, 13, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 97, 11 ], [ 106, 20 ], [ 28, 27 ], [ 39, 38 ], [ 101, 44 ], [ 48, 48 ], [ 55, 54 ], [ 104, 56 ], [ 59, 58 ], [ 62, 61 ], [ 54, 67 ], [ 54, 72 ], [ 61, 73 ], [ 54, 75 ], [ 61, 77 ], [ 58, 81 ], [ 95, 83 ], [ 97, 98 ], [ 106, 107 ] ]
[ "import sys\n\nsys.setrecursionlimit(10 ** 6)\nint1 = lambda x: int(x) - 1\np2D = lambda x: print(*x, sep=\"\\n\")\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef SI(): return sys.stdin.readline()[:-1]\n\ndef main():\n s=SI()\n cnt=0\n for i in range(len(s)-1):\n if s[i]!=s[i+1]:cnt+=1\n print(cnt)\n\nmain()", "import sys", "sys", "sys.setrecursionlimit(10 ** 6)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10 ** 6", "10", "6", "int1 = lambda x: int(x) - 1", "int1", "lambda x: int(x) - 1", "int(x) - 1", "int(x)", "int", "x", "1", "x", "p2D = lambda x: print(*x, sep=\"\\n\")", "p2D", "lambda x: print(*x, sep=\"\\n\")", "print(*x, sep=\"\\n\")", "print", "*x", "x", "sep=\"\\n\"", "sep", "\"\\n\"", "x", "def II(): return int(sys.stdin.readline())", "II", "def MI(): return map(int, sys.stdin.readline().split())", "MI", "def LI(): return list(map(int, sys.stdin.readline().split()))", "LI", "LI() for _ in range(rows_number)", "for _ in range(rows_number)", "_", "range(rows_number)", "range", "rows_number", "for _ in range(rows_number)", "LI()", "LI", "def LLI(rows_number): return [LI() for _ in range(rows_number)]", "LLI", "rows_number", "rows_number", "def SI(): return sys.stdin.readline()[:-1]", "SI", "def main():\n s=SI()\n cnt=0\n for i in range(len(s)-1):\n if s[i]!=s[i+1]:cnt+=1\n print(cnt)", "main", "s=SI()", "s", "SI()", "SI", "cnt=0", "cnt", "0", "for i in range(len(s)-1):\n if s[i]!=s[i+1]:cnt+=1\n ", "i", "range(len(s)-1)", "range", "len(s)-1", "len(s)", "len", "s", "1", "if s[i]!=s[i+1]:cnt+=1\n ", "s[i]!=s[i+1]", "s[i]", "s", "i", "s[i+1]", "s", "i+1", "i", "1", "print(cnt)", "print", "cnt", "main()", "main", "def II(): return int(sys.stdin.readline())", "def II(): return int(sys.stdin.readline())", "II", "def LLI(rows_number): return [LI() for _ in range(rows_number)]", "def LLI(rows_number): return [LI() for _ in range(rows_number)]", "LLI", "def MI(): return map(int, sys.stdin.readline().split())", "def MI(): return map(int, sys.stdin.readline().split())", "MI", "def main():\n s=SI()\n cnt=0\n for i in range(len(s)-1):\n if s[i]!=s[i+1]:cnt+=1\n print(cnt)", "def main():\n s=SI()\n cnt=0\n for i in range(len(s)-1):\n if s[i]!=s[i+1]:cnt+=1\n print(cnt)", "main", "int1 = lambda x: int(x) - 1", "lambda x: int(x) - 1", "int1", "def LI(): return list(map(int, sys.stdin.readline().split()))", "def LI(): return list(map(int, sys.stdin.readline().split()))", "LI", "def SI(): return sys.stdin.readline()[:-1]", "def SI(): return sys.stdin.readline()[:-1]", "SI", "p2D = lambda x: print(*x, sep=\"\\n\")", "lambda x: print(*x, sep=\"\\n\")", "p2D" ]
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] def main(): s=SI() cnt=0 for i in range(len(s)-1): if s[i]!=s[i+1]:cnt+=1 print(cnt) main()
[ 7, 15, 12, 13, 0, 13, 4, 13, 13, 0, 13, 39, 28, 13, 13, 13, 4, 18, 13, 13, 39, 13, 4, 13, 4, 13, 4, 13, 13, 29, 13, 23, 13, 12, 13, 0, 13, 17, 28, 13, 13, 13, 0, 13, 2, 13, 4, 13, 13, 29, 13, 23, 13, 12, 13, 0, 13, 4, 13, 13, 0, 13, 17, 28, 13, 13, 13, 0, 13, 13, 29, 13, 23, 13, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 2, 4, 13, 4, 13, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
[ [ 6, 5 ], [ 32, 8 ], [ 11, 10 ], [ 10, 18 ], [ 10, 30 ], [ 32, 32 ], [ 37, 36 ], [ 44, 43 ], [ 43, 50 ], [ 36, 50 ], [ 52, 52 ], [ 57, 56 ], [ 73, 59 ], [ 62, 61 ], [ 69, 68 ], [ 68, 71 ], [ 61, 71 ], [ 73, 73 ], [ 78, 77 ], [ 82, 81 ], [ 105, 83 ], [ 77, 84 ], [ 87, 86 ], [ 81, 92 ], [ 86, 96 ], [ 108, 102 ] ]
[ "from itertools import groupby\n\n\n# RUN LENGTH ENCODING str -> tuple\ndef runLengthEncode(S: str):\n grouped = groupby(S)\n res = []\n for k, v in grouped:\n res.append((k, str(len(list(v)))))\n return res\n\n\n# RUN LENGTH DECODING tuple -> str\ndef runLengthDecode(L: \"list[tuple]\"):\n res = \"\"\n for c, n in L:\n res += c * int(n)\n return res\n\n\n# RUN LENGTH ENCODING str -> list\ndef rle_list(S: str):\n grouped = groupby(S)\n res = \"\"\n for k, v in grouped:\n res += k\n return res\n\n\ndef main():\n ss = input()\n rle = rle_list(ss)\n ans = len(list(rle)) - 1\n print(ans)\n\n\nif __name__ == \"__main__\":\n main()", "from itertools import groupby", "def runLengthEncode(S: str):\n grouped = groupby(S)\n res = []\n for k, v in grouped:\n res.append((k, str(len(list(v)))))\n return res\n\n\n# RUN LENGTH DECODING tuple -> str", "runLengthEncode", "grouped = groupby(S)", "grouped", "groupby(S)", "groupby", "S", "res = []", "res", "[]", "for k, v in grouped:\n res.append((k, str(len(list(v)))))\n ", "k", "v", "grouped", "res.append((k, str(len(list(v)))))", "res.append", "res", "append", "(k, str(len(list(v))))", "k", "str(len(list(v)))", "str", "len(list(v))", "len", "list(v)", "list", "v", "return res", "res", "S: str", "S", "def runLengthDecode(L: \"list[tuple]\"):\n res = \"\"\n for c, n in L:\n res += c * int(n)\n return res\n\n\n# RUN LENGTH ENCODING str -> list", "runLengthDecode", "res = \"\"", "res", "\"\"", "for c, n in L:\n res += c * int(n)\n ", "c", "n", "L", "res += c * int(n)", "res", "c * int(n)", "c", "int(n)", "int", "n", "return res", "res", "L: \"list[tuple]\"", "L", "def rle_list(S: str):\n grouped = groupby(S)\n res = \"\"\n for k, v in grouped:\n res += k\n return res", "rle_list", "grouped = groupby(S)", "grouped", "groupby(S)", "groupby", "S", "res = \"\"", "res", "\"\"", "for k, v in grouped:\n res += k\n ", "k", "v", "grouped", "res += k", "res", "k", "return res", "res", "S: str", "S", "def main():\n ss = input()\n rle = rle_list(ss)\n ans = len(list(rle)) - 1\n print(ans)", "main", "ss = input()", "ss", "input()", "input", "rle = rle_list(ss)", "rle", "rle_list(ss)", "rle_list", "ss", "ans = len(list(rle)) - 1", "ans", "len(list(rle)) - 1", "len(list(rle))", "len", "list(rle)", "list", "rle", "1", "print(ans)", "print", "ans", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def rle_list(S: str):\n grouped = groupby(S)\n res = \"\"\n for k, v in grouped:\n res += k\n return res", "def rle_list(S: str):\n grouped = groupby(S)\n res = \"\"\n for k, v in grouped:\n res += k\n return res", "rle_list", "def main():\n ss = input()\n rle = rle_list(ss)\n ans = len(list(rle)) - 1\n print(ans)", "def main():\n ss = input()\n rle = rle_list(ss)\n ans = len(list(rle)) - 1\n print(ans)", "main", "def runLengthEncode(S: str):\n grouped = groupby(S)\n res = []\n for k, v in grouped:\n res.append((k, str(len(list(v)))))\n return res\n\n\n# RUN LENGTH DECODING tuple -> str", "def runLengthEncode(S: str):\n grouped = groupby(S)\n res = []\n for k, v in grouped:\n res.append((k, str(len(list(v)))))\n return res\n\n\n# RUN LENGTH DECODING tuple -> str", "runLengthEncode", "def runLengthDecode(L: \"list[tuple]\"):\n res = \"\"\n for c, n in L:\n res += c * int(n)\n return res\n\n\n# RUN LENGTH ENCODING str -> list", "def runLengthDecode(L: \"list[tuple]\"):\n res = \"\"\n for c, n in L:\n res += c * int(n)\n return res\n\n\n# RUN LENGTH ENCODING str -> list", "runLengthDecode" ]
from itertools import groupby # RUN LENGTH ENCODING str -> tuple def runLengthEncode(S: str): grouped = groupby(S) res = [] for k, v in grouped: res.append((k, str(len(list(v))))) return res # RUN LENGTH DECODING tuple -> str def runLengthDecode(L: "list[tuple]"): res = "" for c, n in L: res += c * int(n) return res # RUN LENGTH ENCODING str -> list def rle_list(S: str): grouped = groupby(S) res = "" for k, v in grouped: res += k return res def main(): ss = input() rle = rle_list(ss) ans = len(list(rle)) - 1 print(ans) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 28, 13, 4, 13, 17, 13, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 36, 2 ], [ 45, 6 ], [ 37, 9 ], [ 42, 11 ], [ 15, 14 ], [ 46, 18 ], [ 37, 22 ], [ 14, 23 ], [ 37, 25 ], [ 14, 27 ], [ 39, 30 ], [ 40, 34 ], [ 43, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ], [ 45, 46 ] ]
[ "s = input()\nl = len(s)\ncnt = 0\nfor i in range(1, l):\n if s[i] != s[i - 1]:\n cnt += 1\nprint(cnt)", "s = input()", "s", "input()", "input", "l = len(s)", "l", "len(s)", "len", "s", "cnt = 0", "cnt", "0", "for i in range(1, l):\n if s[i] != s[i - 1]:\n cnt += 1", "i", "range(1, l)", "range", "1", "l", "if s[i] != s[i - 1]:\n cnt += 1", "s[i] != s[i - 1]", "s[i]", "s", "i", "s[i - 1]", "s", "i - 1", "i", "1", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "s = input()", "input()", "s", "cnt += 1", "1", "cnt", "cnt = 0", "0", "cnt", "l = len(s)", "len(s)", "l" ]
s = input() l = len(s) cnt = 0 for i in range(1, l): if s[i] != s[i - 1]: cnt += 1 print(cnt)
[ 7, 0, 13, 4, 13, 4, 13, 2, 4, 18, 13, 13, 17, 4, 18, 13, 13, 17, 10, 4, 13 ]
[ [ 19, 2 ], [ 20, 10 ], [ 20, 15 ], [ 19, 20 ] ]
[ "s = input()\nprint(s.count('WB')+s.count('BW'))", "s = input()", "s", "input()", "input", "print(s.count('WB')+s.count('BW'))", "print", "s.count('WB')+s.count('BW')", "s.count('WB')", "s.count", "s", "count", "'WB'", "s.count('BW')", "s.count", "s", "count", "'BW'", "s = input()", "input()", "s" ]
s = input() print(s.count('WB')+s.count('BW'))
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 13, 13, 0, 13, 18, 13, 13, 0, 13, 17, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 4, 10 ], [ 14, 13 ], [ 17, 16 ], [ 4, 22 ], [ 4, 26 ], [ 16, 27 ], [ 8, 28 ], [ 30, 28 ], [ 31, 30 ], [ 4, 32 ], [ 16, 33 ], [ 36, 35 ], [ 35, 39 ], [ 13, 39 ], [ 48, 45 ] ]
[ "def main():\n s = input()\n before = s[0]\n change = 0\n for i in range(1, len(s)):\n if s[i] != before:\n before = s[i]\n change += 1\n print(change)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n s = input()\n before = s[0]\n change = 0\n for i in range(1, len(s)):\n if s[i] != before:\n before = s[i]\n change += 1\n print(change)", "main", "s = input()", "s", "input()", "input", "before = s[0]", "before", "s[0]", "s", "0", "change = 0", "change", "0", "for i in range(1, len(s)):\n if s[i] != before:\n before = s[i]\n change += 1\n ", "i", "range(1, len(s))", "range", "1", "len(s)", "len", "s", "if s[i] != before:\n before = s[i]\n change += 1\n ", "s[i] != before", "s[i]", "s", "i", "before", "before = s[i]", "before", "s[i]", "s", "i", "change += 1", "change", "1", "print(change)", "print", "change", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n s = input()\n before = s[0]\n change = 0\n for i in range(1, len(s)):\n if s[i] != before:\n before = s[i]\n change += 1\n print(change)", "def main():\n s = input()\n before = s[0]\n change = 0\n for i in range(1, len(s)):\n if s[i] != before:\n before = s[i]\n change += 1\n print(change)", "main" ]
def main(): s = input() before = s[0] change = 0 for i in range(1, len(s)): if s[i] != before: before = s[i] change += 1 print(change) if __name__ == '__main__': main()
[ 7, 12, 13, 17, 15, 0, 13, 39, 13, 39, 0, 13, 39, 17, 28, 13, 13, 4, 13, 13, 4, 18, 13, 13, 13, 29, 39, 13, 13, 13, 23, 13, 0, 13, 4, 13, 4, 13, 13, 13, 4, 13, 2, 4, 13, 13, 17, 10, 12, 13, 10, 4, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 7, 6 ], [ 9, 8 ], [ 12, 11 ], [ 31, 19 ], [ 6, 22 ], [ 31, 31 ], [ 57, 33 ], [ 49, 35 ], [ 57, 38 ], [ 57, 39 ], [ 58, 45 ], [ 57, 52 ], [ 57, 55 ], [ 57, 58 ] ]
[ "# https://atcoder.jp/contests/abc047/tasks/arc063_a\n# 連長圧縮すれば簡単\n# 圧縮後の文字列長-1となる\n\n\n# def run_length_encoding(s):\n# '''連長圧縮を行う\n# s ... iterable object e.g. list, str\n# return\n# ----------\n# s_composed,s_num,s_idx\n# それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n# s_composed, s_sum = [], []\n# s_idx = [0]\n# pre = s[0]\n# cnt = 1\n# for i, ss in enumerate(s[1:], start=1):\n# if pre == ss:\n# cnt += 1\n# else:\n# s_sum.append(cnt)\n# s_composed.append(pre)\n# s_idx.append(i)\n# cnt = 1\n# pre = ss\n# s_sum.append(cnt)\n# s_composed.append(pre)\n# # assert len(s_sum) == len(s_composed)\n# return s_composed, s_sum, s_idx\n\n\ndef run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n from itertools import groupby\n s_composed, s_sum = [], []\n s_idx = [0]\n for k, v in groupby(s):\n s_composed.append(k)\n # n = len(list(v))\n # s_sum.append(n)\n # s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx\n\n\nS_composed, _, _ = run_length_encoding(input())\nprint(len(S_composed) - 1)", "def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n from itertools import groupby\n s_composed, s_sum = [], []\n s_idx = [0]\n for k, v in groupby(s):\n s_composed.append(k)\n # n = len(list(v))\n # s_sum.append(n)\n # s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx", "run_length_encoding", "'''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''", "from itertools import groupby", "s_composed, s_sum = [], []", "s_composed", "[]", "s_sum", "[]", "s_idx = [0]", "s_idx", "[0]", "0", "for k, v in groupby(s):\n s_composed.append(k)\n # n = len(list(v))\n # s_sum.append(n)\n # s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n ", "k", "v", "groupby(s)", "groupby", "s", "s_composed.append(k)", "s_composed.append", "s_composed", "append", "k", "return s_composed, s_sum, s_idx", "return s_composed, s_sum, s_idx", "s_composed", "s_sum", "s_idx", "s", "s", "S_composed, _, _ = run_length_encoding(input())", "S_composed", "run_length_encoding(input())", "run_length_encoding", "input()", "input", "_", "_", "print(len(S_composed) - 1)", "print", "len(S_composed) - 1", "len(S_composed)", "len", "S_composed", "1", "def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n from itertools import groupby\n s_composed, s_sum = [], []\n s_idx = [0]\n for k, v in groupby(s):\n s_composed.append(k)\n # n = len(list(v))\n # s_sum.append(n)\n # s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx", "def run_length_encoding(s):\n '''連長圧縮を行う\n s ... iterable object e.g. list, str\n return\n ----------\n s_composed,s_num,s_idx\n それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx'''\n from itertools import groupby\n s_composed, s_sum = [], []\n s_idx = [0]\n for k, v in groupby(s):\n s_composed.append(k)\n # n = len(list(v))\n # s_sum.append(n)\n # s_idx.append(s_idx[-1] + n)\n\n # assert len(s_sum) == len(s_composed)\n return s_composed, s_sum, s_idx", "run_length_encoding", "_, _ = run_length_encoding(input())", "run_length_encoding(input())", "_", "_ = run_length_encoding(input())", "run_length_encoding(input())", "_", "S_composed, _, _ = run_length_encoding(input())", "run_length_encoding(input())", "S_composed" ]
# https://atcoder.jp/contests/abc047/tasks/arc063_a # 連長圧縮すれば簡単 # 圧縮後の文字列長-1となる # def run_length_encoding(s): # '''連長圧縮を行う # s ... iterable object e.g. list, str # return # ---------- # s_composed,s_num,s_idx # それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx''' # s_composed, s_sum = [], [] # s_idx = [0] # pre = s[0] # cnt = 1 # for i, ss in enumerate(s[1:], start=1): # if pre == ss: # cnt += 1 # else: # s_sum.append(cnt) # s_composed.append(pre) # s_idx.append(i) # cnt = 1 # pre = ss # s_sum.append(cnt) # s_composed.append(pre) # # assert len(s_sum) == len(s_composed) # return s_composed, s_sum, s_idx def run_length_encoding(s): '''連長圧縮を行う s ... iterable object e.g. list, str return ---------- s_composed,s_num,s_idx それぞれ、圧縮後の文字列、その文字数、その文字が始まるidx''' from itertools import groupby s_composed, s_sum = [], [] s_idx = [0] for k, v in groupby(s): s_composed.append(k) # n = len(list(v)) # s_sum.append(n) # s_idx.append(s_idx[-1] + n) # assert len(s_sum) == len(s_composed) return s_composed, s_sum, s_idx S_composed, _, _ = run_length_encoding(input()) print(len(S_composed) - 1)
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 17, 13, 10, 13, 13, 10, 4, 13, 10, 18, 13, 10, 17, 13 ]
[ [ 36, 2 ], [ 39, 6 ], [ 37, 8 ], [ 30, 11 ], [ 15, 14 ], [ 37, 14 ], [ 40, 18 ], [ 34, 18 ], [ 14, 19 ], [ 42, 21 ], [ 33, 24 ], [ 14, 25 ], [ 43, 28 ], [ 31, 28 ], [ 30, 31 ], [ 14, 33 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ] ]
[ "s = input()\ntemp = s[0]\nans = 0\nfor l in s:\n if temp!=l:\n ans += 1\n temp = l\nprint(ans)", "s = input()", "s", "input()", "input", "temp = s[0]", "temp", "s[0]", "s", "0", "ans = 0", "ans", "0", "for l in s:\n if temp!=l:\n ans += 1\n temp = l", "l", "s", "if temp!=l:\n ans += 1\n ", "temp!=l", "temp", "l", "ans += 1", "ans", "1", "temp = l", "temp", "l", "print(ans)", "print", "ans", "ans = 0", "0", "ans", "temp = l", "l", "temp", "s = input()", "input()", "s", "temp = s[0]", "s[0]", "temp", "ans += 1", "1", "ans" ]
s = input() temp = s[0] ans = 0 for l in s: if temp!=l: ans += 1 temp = l print(ans)
[ 7, 15, 0, 13, 4, 13, 0, 13, 4, 13, 13, 4, 13, 2, 4, 13, 4, 13, 13, 17, 10, 4, 13, 10, 4, 13 ]
[ [ 24, 3 ], [ 21, 7 ], [ 25, 10 ], [ 22, 18 ], [ 21, 22 ], [ 24, 25 ] ]
[ "from itertools import groupby\nS=input()\nG=groupby(S)\nprint(len(list(G))-1)", "from itertools import groupby", "S=input()", "S", "input()", "input", "G=groupby(S)", "G", "groupby(S)", "groupby", "S", "print(len(list(G))-1)", "print", "len(list(G))-1", "len(list(G))", "len", "list(G)", "list", "G", "1", "G=groupby(S)", "groupby(S)", "G", "S=input()", "input()", "S" ]
from itertools import groupby S=input() G=groupby(S) print(len(list(G))-1)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 2, 4, 13, 13, 17, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 34, 2 ], [ 37, 6 ], [ 10, 9 ], [ 35, 15 ], [ 35, 20 ], [ 9, 21 ], [ 35, 23 ], [ 9, 25 ], [ 40, 28 ], [ 41, 32 ], [ 38, 32 ], [ 34, 35 ], [ 37, 38 ], [ 40, 41 ] ]
[ "S = input()\nans = 0\n\nfor i in range(len(S)-1):\n if S[i] != S[i+1]:\n ans += 1\n\nprint(ans)", "S = input()", "S", "input()", "input", "ans = 0", "ans", "0", "for i in range(len(S)-1):\n if S[i] != S[i+1]:\n ans += 1", "i", "range(len(S)-1)", "range", "len(S)-1", "len(S)", "len", "S", "1", "if S[i] != S[i+1]:\n ans += 1", "S[i] != S[i+1]", "S[i]", "S", "i", "S[i+1]", "S", "i+1", "i", "1", "ans += 1", "ans", "1", "print(ans)", "print", "ans", "S = input()", "input()", "S", "ans = 0", "0", "ans", "ans += 1", "1", "ans" ]
S = input() ans = 0 for i in range(len(S)-1): if S[i] != S[i+1]: ans += 1 print(ans)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 17, 0, 13, 39, 42, 2, 13, 13, 42, 2, 2, 13, 2, 13, 17, 2, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 18, 13, 13, 13, 0, 13, 17, 4, 13, 2, 4, 13, 13, 17, 10, 17, 13, 10, 39, 13, 10, 4, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 66, 2 ], [ 63, 8 ], [ 67, 11 ], [ 69, 13 ], [ 60, 16 ], [ 70, 20 ], [ 73, 20 ], [ 58, 20 ], [ 64, 21 ], [ 70, 25 ], [ 58, 25 ], [ 73, 25 ], [ 64, 27 ], [ 67, 31 ], [ 70, 32 ], [ 58, 32 ], [ 73, 32 ], [ 67, 34 ], [ 70, 36 ], [ 58, 36 ], [ 73, 36 ], [ 57, 39 ], [ 61, 43 ], [ 58, 45 ], [ 70, 45 ], [ 73, 45 ], [ 72, 47 ], [ 61, 54 ], [ 57, 58 ], [ 60, 61 ], [ 63, 64 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ] ]
[ "l = list(input())\nn = len(l)\n\nidx = 0\nseg = []\nwhile idx < n:\n while idx < n-1 and l[idx] == l[idx+1]:\n idx+=1\n seg.append(idx)\n idx+=1\nprint(len(seg)-1)", "l = list(input())", "l", "list(input())", "list", "input()", "input", "n = len(l)", "n", "len(l)", "len", "l", "idx = 0", "idx", "0", "seg = []", "seg", "[]", "while idx < n:\n while idx < n-1 and l[idx] == l[idx+1]:\n idx+=1\n seg.append(idx)\n idx+=1", "idx < n", "idx", "n", "while idx < n-1 and l[idx] == l[idx+1]:\n idx+=1\n ", "idx < n-1 and l[idx] == l[idx+1]", "idx < n-1", "idx", "n-1", "n", "1", "l[idx] == l[idx+1]", "l[idx]", "l", "idx", "l[idx+1]", "l", "idx+1", "idx", "1", "idx+=1", "idx", "1", "seg.append(idx)", "seg.append", "seg", "append", "idx", "idx+=1", "idx", "1", "print(len(seg)-1)", "print", "len(seg)-1", "len(seg)", "len", "seg", "1", "idx+=1", "1", "idx", "seg = []", "[]", "seg", "n = len(l)", "len(l)", "n", "l = list(input())", "list(input())", "l", "idx = 0", "0", "idx", "idx+=1", "1", "idx" ]
l = list(input()) n = len(l) idx = 0 seg = [] while idx < n: while idx < n-1 and l[idx] == l[idx+1]: idx+=1 seg.append(idx) idx+=1 print(len(seg)-1)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 13, 18, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 13, 10, 18, 13, 10, 17, 13, 10, 18, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 51, 2 ], [ 42, 6 ], [ 39, 9 ], [ 52, 11 ], [ 15, 14 ], [ 52, 20 ], [ 40, 23 ], [ 46, 23 ], [ 52, 25 ], [ 14, 26 ], [ 48, 28 ], [ 45, 31 ], [ 52, 33 ], [ 14, 34 ], [ 49, 37 ], [ 43, 37 ], [ 39, 40 ], [ 42, 43 ], [ 45, 46 ], [ 48, 49 ], [ 51, 52 ] ]
[ "s = input()\n\ncnt = 0\nback = s[0]\nfor i in range(1, len(s)):\n if back != s[i]:\n cnt += 1\n back = s[i]\nprint(cnt)", "s = input()", "s", "input()", "input", "cnt = 0", "cnt", "0", "back = s[0]", "back", "s[0]", "s", "0", "for i in range(1, len(s)):\n if back != s[i]:\n cnt += 1\n back = s[i]", "i", "range(1, len(s))", "range", "1", "len(s)", "len", "s", "if back != s[i]:\n cnt += 1\n ", "back != s[i]", "back", "s[i]", "s", "i", "cnt += 1", "cnt", "1", "back = s[i]", "back", "s[i]", "s", "i", "print(cnt)", "print", "cnt", "back = s[0]", "s[0]", "back", "cnt = 0", "0", "cnt", "back = s[i]", "s[i]", "back", "cnt += 1", "1", "cnt", "s = input()", "input()", "s" ]
s = input() cnt = 0 back = s[0] for i in range(1, len(s)): if back != s[i]: cnt += 1 back = s[i] print(cnt)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 2, 13, 17, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 38, 2 ], [ 41, 8 ], [ 12, 11 ], [ 39, 17 ], [ 39, 21 ], [ 11, 23 ], [ 39, 26 ], [ 11, 27 ], [ 35, 29 ], [ 36, 33 ], [ 42, 33 ], [ 35, 36 ], [ 38, 39 ], [ 41, 42 ] ]
[ "S=str(input())\nans=0\nfor i in range(1,len(S)):\n if S[i-1]!=S[i]:\n ans+=1\nprint(ans)", "S=str(input())", "S", "str(input())", "str", "input()", "input", "ans=0", "ans", "0", "for i in range(1,len(S)):\n if S[i-1]!=S[i]:\n ans+=1", "i", "range(1,len(S))", "range", "1", "len(S)", "len", "S", "if S[i-1]!=S[i]:\n ans+=1", "S[i-1]!=S[i]", "S[i-1]", "S", "i-1", "i", "1", "S[i]", "S", "i", "ans+=1", "ans", "1", "print(ans)", "print", "ans", "ans+=1", "1", "ans", "S=str(input())", "str(input())", "S", "ans=0", "0", "ans" ]
S=str(input()) ans=0 for i in range(1,len(S)): if S[i-1]!=S[i]: ans+=1 print(ans)
[ 7, 15, 12, 13, 0, 13, 18, 13, 13, 0, 13, 4, 18, 4, 13, 13, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 13, 17, 0, 13, 18, 13, 13, 14, 40, 13, 18, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 2, 13, 17, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 6, 5 ], [ 11, 10 ], [ 5, 14 ], [ 18, 17 ], [ 21, 20 ], [ 10, 25 ], [ 20, 28 ], [ 32, 31 ], [ 10, 33 ], [ 20, 34 ], [ 45, 37 ], [ 31, 37 ], [ 10, 39 ], [ 20, 40 ], [ 43, 42 ], [ 46, 45 ], [ 10, 47 ], [ 20, 48 ], [ 42, 52 ], [ 17, 52 ], [ 62, 59 ] ]
[ "from sys import stdin\ndef main():\n #入力\n readline=stdin.readline\n s=readline().strip()\n\n cnt=1\n for i in range(len(s)):\n if i==0:\n now=s[i]\n else:\n if now!=s[i]:\n cnt+=1\n now=s[i]\n\n print(cnt-1)\n\nif __name__==\"__main__\":\n main()", "from sys import stdin", "def main():\n #入力\n readline=stdin.readline\n s=readline().strip()\n\n cnt=1\n for i in range(len(s)):\n if i==0:\n now=s[i]\n else:\n if now!=s[i]:\n cnt+=1\n now=s[i]\n\n print(cnt-1)", "main", "readline=stdin.readline", "readline", "stdin.readline", "stdin", "readline", "s=readline().strip()", "s", "readline().strip()", "().strip", "()", "readline", "strip", "cnt=1", "cnt", "1", "for i in range(len(s)):\n if i==0:\n now=s[i]\n else:\n if now!=s[i]:\n cnt+=1\n now=s[i]\n\n ", "i", "range(len(s))", "range", "len(s)", "len", "s", "if i==0:\n now=s[i]\n else:\n if now!=s[i]:\n cnt+=1\n now=s[i]\n\n ", "i==0", "i", "0", "now=s[i]", "now", "s[i]", "s", "i", "if now!=s[i]:\n cnt+=1\n now=s[i]\n\n ", "now!=s[i]", "now", "s[i]", "s", "i", "cnt+=1", "cnt", "1", "now=s[i]", "now", "s[i]", "s", "i", "print(cnt-1)", "print", "cnt-1", "cnt", "1", "if __name__==\"__main__\":\n main()", "__name__==\"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def main():\n #入力\n readline=stdin.readline\n s=readline().strip()\n\n cnt=1\n for i in range(len(s)):\n if i==0:\n now=s[i]\n else:\n if now!=s[i]:\n cnt+=1\n now=s[i]\n\n print(cnt-1)", "def main():\n #入力\n readline=stdin.readline\n s=readline().strip()\n\n cnt=1\n for i in range(len(s)):\n if i==0:\n now=s[i]\n else:\n if now!=s[i]:\n cnt+=1\n now=s[i]\n\n print(cnt-1)", "main" ]
from sys import stdin def main(): #入力 readline=stdin.readline s=readline().strip() cnt=1 for i in range(len(s)): if i==0: now=s[i] else: if now!=s[i]: cnt+=1 now=s[i] print(cnt-1) if __name__=="__main__": main()
[ 7, 17, 15, 13, 15, 0, 13, 4, 13, 4, 13, 0, 13, 2, 4, 13, 4, 13, 4, 13, 13, 17, 4, 13, 13, 17, 10, 4, 13, 10, 2, 13 ]
[ [ 27, 6 ], [ 30, 12 ], [ 28, 20 ], [ 31, 24 ], [ 27, 28 ], [ 30, 31 ] ]
[ "# -*- coding: utf-8 -*-\n\"\"\"\nCreated on Thu Jun 11 17:09:47 2020\n\n@author: sd18016\n\"\"\" \n\nimport sys\nfrom itertools import groupby\n\n\nS = list(input())\n\nans = len(list(groupby(S)))-1\nprint(ans)\n \n \n\n\n\"\"\"\nfor i in range(N):\n if list_x[i][2] == 1:\n de = list_x[i][0]\n S -= de*H\n W -= de\n elif list_x[i][2] == 2:\n de = W - list_x[i][0]\n S -= de*H\n W -= de\n elif list_x[i][2] == 3:\n de = list_x[i][1]\n S -= de*W\n H -= de\n else:\n de = H - list_x[i][1]\n S -= de*W\n H -= de\n\nprint(S)\n\"\"\"", "\"\"\"\nCreated on Thu Jun 11 17:09:47 2020\n\n@author: sd18016\n\"\"\"", "import sys", "sys", "from itertools import groupby", "S = list(input())", "S", "list(input())", "list", "input()", "input", "ans = len(list(groupby(S)))-1", "ans", "len(list(groupby(S)))-1", "len(list(groupby(S)))", "len", "list(groupby(S))", "list", "groupby(S)", "groupby", "S", "1", "print(ans)", "print", "ans", "\"\"\"\nfor i in range(N):\n if list_x[i][2] == 1:\n de = list_x[i][0]\n S -= de*H\n W -= de\n elif list_x[i][2] == 2:\n de = W - list_x[i][0]\n S -= de*H\n W -= de\n elif list_x[i][2] == 3:\n de = list_x[i][1]\n S -= de*W\n H -= de\n else:\n de = H - list_x[i][1]\n S -= de*W\n H -= de\n\nprint(S)\n\"\"\"", "S = list(input())", "list(input())", "S", "ans = len(list(groupby(S)))-1", "len(list(groupby(S)))-1", "ans" ]
# -*- coding: utf-8 -*- """ Created on Thu Jun 11 17:09:47 2020 @author: sd18016 """ import sys from itertools import groupby S = list(input()) ans = len(list(groupby(S)))-1 print(ans) """ for i in range(N): if list_x[i][2] == 1: de = list_x[i][0] S -= de*H W -= de elif list_x[i][2] == 2: de = W - list_x[i][0] S -= de*H W -= de elif list_x[i][2] == 3: de = list_x[i][1] S -= de*W H -= de else: de = H - list_x[i][1] S -= de*W H -= de print(S) """
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 39, 28, 13, 13, 14, 40, 13, 13, 4, 18, 13, 13, 13, 0, 13, 13, 4, 13, 2, 4, 13, 13, 17, 10, 39, 13, 10, 4, 13, 10, 17, 13, 10, 13, 13 ]
[ [ 37, 2 ], [ 40, 6 ], [ 34, 9 ], [ 13, 12 ], [ 38, 12 ], [ 12, 16 ], [ 41, 17 ], [ 44, 17 ], [ 35, 20 ], [ 12, 22 ], [ 43, 24 ], [ 12, 25 ], [ 35, 31 ], [ 34, 35 ], [ 37, 38 ], [ 40, 41 ], [ 12, 43 ], [ 43, 44 ] ]
[ "s= input()\ncolor = \"chokudai\"\nd = []\n\nfor c in s:\n if c != color:\n d.append(c)\n color = c\nprint(len(d)-1)", "s= input()", "s", "input()", "input", "color = \"chokudai\"", "color", "\"chokudai\"", "d = []", "d", "[]", "for c in s:\n if c != color:\n d.append(c)\n color = c", "c", "s", "if c != color:\n d.append(c)\n color = c", "c != color", "c", "color", "d.append(c)", "d.append", "d", "append", "c", "color = c", "color", "c", "print(len(d)-1)", "print", "len(d)-1", "len(d)", "len", "d", "1", "d = []", "[]", "d", "s= input()", "input()", "s", "color = \"chokudai\"", "\"chokudai\"", "color", "color = c", "c", "color" ]
s= input() color = "chokudai" d = [] for c in s: if c != color: d.append(c) color = c print(len(d)-1)
[ 7, 0, 13, 4, 13, 4, 13, 4, 13, 40, 13, 13, 10, 4, 13 ]
[ [ 13, 2 ], [ 13, 14 ] ]
[ "s = input()\nprint(sum(a != b for a, b in zip(s, s[1:])))", "s = input()", "s", "input()", "input", "print(sum(a != b for a, b in zip(s, s[1:])))", "print", "sum(a != b for a, b in zip(s, s[1:]))", "sum", "a != b", "a", "b", "s = input()", "input()", "s" ]
s = input() print(sum(a != b for a, b in zip(s, s[1:])))
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 4, 13, 13, 28, 13, 4, 13, 2, 13, 17, 14, 2, 18, 13, 13, 18, 13, 2, 13, 17, 0, 18, 13, 13, 17, 4, 13, 2, 2, 4, 18, 13, 13, 17, 4, 18, 13, 13, 17, 17, 10, 4, 13, 10, 4, 13 ]
[ [ 53, 2 ], [ 50, 8 ], [ 54, 11 ], [ 14, 13 ], [ 51, 17 ], [ 30, 21 ], [ 54, 22 ], [ 13, 23 ], [ 54, 25 ], [ 13, 27 ], [ 33, 30 ], [ 54, 31 ], [ 13, 32 ], [ 54, 40 ], [ 54, 45 ], [ 50, 51 ], [ 53, 54 ] ]
[ "s=list(input())\nl=len(s)\n\nfor i in range(l-1):\n if s[i]==s[i+1]:\n s[i]='0'\n \nprint(s.count('B')+s.count('W')-1)", "s=list(input())", "s", "list(input())", "list", "input()", "input", "l=len(s)", "l", "len(s)", "len", "s", "for i in range(l-1):\n if s[i]==s[i+1]:\n s[i]='0'\n ", "i", "range(l-1)", "range", "l-1", "l", "1", "if s[i]==s[i+1]:\n s[i]='0'\n ", "s[i]==s[i+1]", "s[i]", "s", "i", "s[i+1]", "s", "i+1", "i", "1", "s[i]='0'", "s[i]", "s", "i", "'0'", "print(s.count('B')+s.count('W')-1)", "print", "s.count('B')+s.count('W')-1", "s.count('B')+s.count('W')", "s.count('B')", "s.count", "s", "count", "'B'", "s.count('W')", "s.count", "s", "count", "'W'", "1", "l=len(s)", "len(s)", "l", "s=list(input())", "list(input())", "s" ]
s=list(input()) l=len(s) for i in range(l-1): if s[i]==s[i+1]: s[i]='0' print(s.count('B')+s.count('W')-1)
[ 7, 15, 13, 12, 13, 0, 13, 4, 13, 0, 13, 4, 13, 13, 4, 13, 4, 13, 40, 18, 13, 13, 18, 13, 2, 13, 17, 10, 12, 13, 10, 4, 13, 10, 4, 13 ]
[ [ 34, 6 ], [ 29, 8 ], [ 31, 10 ], [ 35, 13 ], [ 35, 20 ], [ 35, 23 ], [ 31, 32 ], [ 34, 35 ] ]
[ "import sys\ndef LS2(): return list(sys.stdin.readline().rstrip()) #空白なし\n\n\nS = LS2()\nN = len(S)\n\nprint(sum(S[i] != S[i+1] for i in range(N-1)))", "import sys", "sys", "def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし", "LS2", "S = LS2()", "S", "LS2()", "LS2", "N = len(S)", "N", "len(S)", "len", "S", "print(sum(S[i] != S[i+1] for i in range(N-1)))", "print", "sum(S[i] != S[i+1] for i in range(N-1))", "sum", "S[i] != S[i+1]", "S[i]", "S", "i", "S[i+1]", "S", "i+1", "i", "1", "def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし", "def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし", "LS2", "N = len(S)", "len(S)", "N", "S = LS2()", "LS2()", "S" ]
import sys def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし S = LS2() N = len(S) print(sum(S[i] != S[i+1] for i in range(N-1)))
[ 7, 15, 13, 0, 13, 4, 18, 4, 18, 18, 13, 13, 13, 13, 0, 13, 17, 28, 13, 4, 13, 2, 4, 13, 13, 17, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 43, 4 ], [ 46, 15 ], [ 19, 18 ], [ 44, 24 ], [ 44, 29 ], [ 18, 30 ], [ 44, 32 ], [ 18, 34 ], [ 49, 37 ], [ 50, 41 ], [ 47, 41 ], [ 43, 44 ], [ 46, 47 ], [ 49, 50 ] ]
[ "import sys\n\nS = sys.stdin.readline().strip()\nchanged = 0\nfor i in range(len(S) - 1):\n if S[i] != S[i+1]:\n changed += 1\n\nprint(changed)", "import sys", "sys", "S = sys.stdin.readline().strip()", "S", "sys.stdin.readline().strip()", "sys.stdin.readline().strip", "sys.stdin.readline()", "sys.stdin.readline", "sys.stdin", "sys", "stdin", "readline", "strip", "changed = 0", "changed", "0", "for i in range(len(S) - 1):\n if S[i] != S[i+1]:\n changed += 1", "i", "range(len(S) - 1)", "range", "len(S) - 1", "len(S)", "len", "S", "1", "if S[i] != S[i+1]:\n changed += 1", "S[i] != S[i+1]", "S[i]", "S", "i", "S[i+1]", "S", "i+1", "i", "1", "changed += 1", "changed", "1", "print(changed)", "print", "changed", "S = sys.stdin.readline().strip()", "sys.stdin.readline().strip()", "S", "changed = 0", "0", "changed", "changed += 1", "1", "changed" ]
import sys S = sys.stdin.readline().strip() changed = 0 for i in range(len(S) - 1): if S[i] != S[i+1]: changed += 1 print(changed)
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 12, 11 ], [ 4, 13 ], [ 17, 16 ], [ 4, 16 ], [ 16, 20 ], [ 11, 21 ], [ 26, 21 ], [ 24, 23 ], [ 27, 26 ], [ 16, 27 ], [ 23, 30 ], [ 8, 30 ], [ 39, 36 ] ]
[ "def main():\n S = input()\n ans = 0\n before_c = S[0]\n for c in S:\n if c != before_c:\n ans += 1\n before_c = c\n print(ans)\n\n\nif __name__ == '__main__':\n main()", "def main():\n S = input()\n ans = 0\n before_c = S[0]\n for c in S:\n if c != before_c:\n ans += 1\n before_c = c\n print(ans)", "main", "S = input()", "S", "input()", "input", "ans = 0", "ans", "0", "before_c = S[0]", "before_c", "S[0]", "S", "0", "for c in S:\n if c != before_c:\n ans += 1\n before_c = c\n ", "c", "S", "if c != before_c:\n ans += 1\n before_c = c\n ", "c != before_c", "c", "before_c", "ans += 1", "ans", "1", "before_c = c", "before_c", "c", "print(ans)", "print", "ans", "if __name__ == '__main__':\n main()", "__name__ == '__main__'", "__name__", "'__main__'", "main()", "main", "def main():\n S = input()\n ans = 0\n before_c = S[0]\n for c in S:\n if c != before_c:\n ans += 1\n before_c = c\n print(ans)", "def main():\n S = input()\n ans = 0\n before_c = S[0]\n for c in S:\n if c != before_c:\n ans += 1\n before_c = c\n print(ans)", "main" ]
def main(): S = input() ans = 0 before_c = S[0] for c in S: if c != before_c: ans += 1 before_c = c print(ans) if __name__ == '__main__': main()
[ 7, 15, 15, 15, 15, 13, 13, 13, 13, 13, 4, 18, 13, 13, 2, 17, 17, 0, 13, 2, 2, 17, 17, 17, 0, 13, 4, 13, 17, 12, 13, 12, 13, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 12, 13, 10, 12, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13, 10, 4, 13, 10, 13, 13, 10, 2, 13, 10, 17, 13 ]
[ [ 81, 18 ], [ 69, 25 ], [ 75, 34 ], [ 84, 38 ], [ 66, 41 ], [ 45, 44 ], [ 76, 44 ], [ 85, 48 ], [ 79, 48 ], [ 44, 49 ], [ 72, 51 ], [ 78, 54 ], [ 44, 55 ], [ 73, 58 ], [ 67, 58 ], [ 66, 67 ], [ 69, 70 ], [ 72, 73 ], [ 75, 76 ], [ 44, 78 ], [ 78, 79 ], [ 81, 82 ], [ 84, 85 ] ]
[ "from collections import Counter,defaultdict,deque\nfrom heapq import heappop,heappush,heapify\nfrom bisect import bisect_left,bisect_right \nimport sys,math,itertools,fractions,pprint\nsys.setrecursionlimit(10**8)\nmod = 10**9+7\nINF = float('inf')\ndef inp(): return int(sys.stdin.readline())\ndef inpl(): return list(map(int, sys.stdin.readline().split()))\n\ns = input()\nnow = -1\nres = -1\nfor x in s:\n if now != x:\n res += 1\n now = x\nprint(res)", "from collections import Counter,defaultdict,deque", "from heapq import heappop,heappush,heapify", "from bisect import bisect_left,bisect_right", "import sys,math,itertools,fractions,pprint", "sys", "math", "itertools", "fractions", "pprint", "sys.setrecursionlimit(10**8)", "sys.setrecursionlimit", "sys", "setrecursionlimit", "10**8", "10", "8", "mod = 10**9+7", "mod", "10**9+7", "10**9", "10", "9", "7", "INF = float('inf')", "INF", "float('inf')", "float", "'inf'", "def inp(): return int(sys.stdin.readline())", "inp", "def inpl(): return list(map(int, sys.stdin.readline().split()))", "inpl", "s = input()", "s", "input()", "input", "now = -1", "now", "-1", "res = -1", "res", "-1", "for x in s:\n if now != x:\n res += 1\n now = x", "x", "s", "if now != x:\n res += 1\n now = x", "now != x", "now", "x", "res += 1", "res", "1", "now = x", "now", "x", "print(res)", "print", "res", "def inp(): return int(sys.stdin.readline())", "def inp(): return int(sys.stdin.readline())", "inp", "def inpl(): return list(map(int, sys.stdin.readline().split()))", "def inpl(): return list(map(int, sys.stdin.readline().split()))", "inpl", "res = -1", "-1", "res", "INF = float('inf')", "float('inf')", "INF", "res += 1", "1", "res", "s = input()", "input()", "s", "now = x", "x", "now", "mod = 10**9+7", "10**9+7", "mod", "now = -1", "-1", "now" ]
from collections import Counter,defaultdict,deque from heapq import heappop,heappush,heapify from bisect import bisect_left,bisect_right import sys,math,itertools,fractions,pprint sys.setrecursionlimit(10**8) mod = 10**9+7 INF = float('inf') def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) s = input() now = -1 res = -1 for x in s: if now != x: res += 1 now = x print(res)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 2, 13, 17, 18, 13, 13, 0, 13, 17, 4, 13, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13 ]
[ [ 35, 2 ], [ 38, 8 ], [ 12, 11 ], [ 36, 17 ], [ 36, 21 ], [ 11, 23 ], [ 36, 26 ], [ 11, 27 ], [ 41, 29 ], [ 42, 33 ], [ 39, 33 ], [ 35, 36 ], [ 38, 39 ], [ 41, 42 ] ]
[ "S=list(input())\n\nanswer=0\nfor i in range(1,len(S)):\n if S[i-1]!=S[i]:\n answer+=1\n \nprint(answer)", "S=list(input())", "S", "list(input())", "list", "input()", "input", "answer=0", "answer", "0", "for i in range(1,len(S)):\n if S[i-1]!=S[i]:\n answer+=1\n ", "i", "range(1,len(S))", "range", "1", "len(S)", "len", "S", "if S[i-1]!=S[i]:\n answer+=1\n ", "S[i-1]!=S[i]", "S[i-1]", "S", "i-1", "i", "1", "S[i]", "S", "i", "answer+=1", "answer", "1", "print(answer)", "print", "answer", "S=list(input())", "list(input())", "S", "answer=0", "0", "answer", "answer+=1", "1", "answer" ]
S=list(input()) answer=0 for i in range(1,len(S)): if S[i-1]!=S[i]: answer+=1 print(answer)
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 4, 13, 4, 13, 13, 14, 2, 13, 17, 0, 13, 18, 13, 13, 9, 14, 40, 13, 18, 13, 13, 0, 13, 17, 0, 13, 18, 13, 13, 4, 13, 13, 10, 18, 13, 10, 4, 13, 10, 17, 13, 10, 17, 13, 10, 18, 13, 10, 17, 13 ]
[ [ 49, 2 ], [ 55, 6 ], [ 52, 9 ], [ 13, 12 ], [ 50, 17 ], [ 12, 20 ], [ 58, 23 ], [ 50, 25 ], [ 12, 26 ], [ 59, 30 ], [ 53, 30 ], [ 47, 30 ], [ 50, 32 ], [ 12, 33 ], [ 61, 35 ], [ 46, 38 ], [ 50, 40 ], [ 12, 41 ], [ 62, 44 ], [ 56, 44 ], [ 46, 47 ], [ 49, 50 ], [ 52, 53 ], [ 55, 56 ], [ 58, 59 ], [ 61, 62 ] ]
[ "S = input()\nanswer = 0\npresent_color = ''\nfor i in range(len(S)):\n if i == 0:\n present_color = S[i]\n continue\n if present_color != S[i]:\n answer += 1\n else:\n pass\n present_color = S[i]\nprint(answer)", "S = input()", "S", "input()", "input", "answer = 0", "answer", "0", "present_color = ''", "present_color", "''", "for i in range(len(S)):\n if i == 0:\n present_color = S[i]\n continue\n if present_color != S[i]:\n answer += 1\n else:\n pass\n present_color = S[i]", "i", "range(len(S))", "range", "len(S)", "len", "S", "if i == 0:\n present_color = S[i]\n continue\n ", "i == 0", "i", "0", "present_color = S[i]", "present_color", "S[i]", "S", "i", "continue", "if present_color != S[i]:\n answer += 1\n else:\n pass\n ", "present_color != S[i]", "present_color", "S[i]", "S", "i", "answer += 1", "answer", "1", "present_color = S[i]", "present_color", "S[i]", "S", "i", "print(answer)", "print", "answer", "present_color = S[i]", "S[i]", "present_color", "S = input()", "input()", "S", "present_color = ''", "''", "present_color", "answer = 0", "0", "answer", "present_color = S[i]", "S[i]", "present_color", "answer += 1", "1", "answer" ]
S = input() answer = 0 present_color = '' for i in range(len(S)): if i == 0: present_color = S[i] continue if present_color != S[i]: answer += 1 else: pass present_color = S[i] print(answer)
[ 7, 12, 13, 0, 13, 4, 13, 0, 13, 2, 4, 18, 13, 13, 17, 4, 18, 13, 13, 17, 29, 13, 4, 13, 4, 13, 10, 12, 13 ]
[ [ 5, 4 ], [ 9, 8 ], [ 4, 12 ], [ 4, 17 ], [ 8, 21 ], [ 28, 25 ] ]
[ "def solve():\n S = input()\n ans = S.count('BW')+S.count('WB')\n return ans\nprint(solve())", "def solve():\n S = input()\n ans = S.count('BW')+S.count('WB')\n return ans", "solve", "S = input()", "S", "input()", "input", "ans = S.count('BW')+S.count('WB')", "ans", "S.count('BW')+S.count('WB')", "S.count('BW')", "S.count", "S", "count", "'BW'", "S.count('WB')", "S.count", "S", "count", "'WB'", "return ans", "ans", "print(solve())", "print", "solve()", "solve", "def solve():\n S = input()\n ans = S.count('BW')+S.count('WB')\n return ans", "def solve():\n S = input()\n ans = S.count('BW')+S.count('WB')\n return ans", "solve" ]
def solve(): S = input() ans = S.count('BW')+S.count('WB') return ans print(solve())
[ 7, 0, 13, 4, 13, 0, 13, 4, 13, 13, 0, 13, 2, 39, 17, 13, 0, 18, 13, 17, 17, 28, 13, 4, 13, 17, 13, 14, 2, 18, 13, 2, 13, 17, 18, 13, 13, 9, 0, 18, 13, 13, 17, 4, 13, 2, 4, 13, 13, 17, 10, 4, 13, 10, 4, 13, 10, 2, 13 ]
[ [ 54, 2 ], [ 51, 6 ], [ 55, 9 ], [ 57, 11 ], [ 52, 15 ], [ 20, 17 ], [ 58, 18 ], [ 23, 22 ], [ 52, 26 ], [ 55, 30 ], [ 22, 32 ], [ 55, 35 ], [ 22, 36 ], [ 42, 39 ], [ 58, 40 ], [ 22, 41 ], [ 58, 48 ], [ 51, 52 ], [ 54, 55 ], [ 57, 58 ] ]
[ "s = input()\nn = len(s)\n\ndp = [0]*n\ndp[0]=1\nfor i in range(1,n):\n if s[i-1]==s[i]:\n continue\n dp[i]=1\nprint(sum(dp)-1)", "s = input()", "s", "input()", "input", "n = len(s)", "n", "len(s)", "len", "s", "dp = [0]*n", "dp", "[0]*n", "[0]", "0", "n", "dp[0]=1", "dp[0]", "dp", "0", "1", "for i in range(1,n):\n if s[i-1]==s[i]:\n continue\n dp[i]=1", "i", "range(1,n)", "range", "1", "n", "if s[i-1]==s[i]:\n continue\n ", "s[i-1]==s[i]", "s[i-1]", "s", "i-1", "i", "1", "s[i]", "s", "i", "continue", "dp[i]=1", "dp[i]", "dp", "i", "1", "print(sum(dp)-1)", "print", "sum(dp)-1", "sum(dp)", "sum", "dp", "1", "n = len(s)", "len(s)", "n", "s = input()", "input()", "s", "dp = [0]*n", "[0]*n", "dp" ]
s = input() n = len(s) dp = [0]*n dp[0]=1 for i in range(1,n): if s[i-1]==s[i]: continue dp[i]=1 print(sum(dp)-1)
[ 7, 15, 13, 12, 13, 0, 13, 4, 13, 0, 13, 17, 0, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 2, 13, 17, 14, 2, 13, 17, 4, 13, 10, 12, 13 ]
[ [ 7, 6 ], [ 11, 10 ], [ 14, 13 ], [ 17, 16 ], [ 6, 16 ], [ 16, 20 ], [ 13, 21 ], [ 26, 21 ], [ 24, 23 ], [ 27, 26 ], [ 16, 27 ], [ 23, 31 ], [ 10, 31 ], [ 41, 38 ] ]
[ "import collections\n\n\ndef main():\n S = input()\n cnt = 0\n tmp = \"\"\n for s in S:\n if s != tmp:\n cnt += 1\n tmp = s\n\n print(cnt - 1)\n\n\nif __name__ == \"__main__\":\n main()", "import collections", "collections", "def main():\n S = input()\n cnt = 0\n tmp = \"\"\n for s in S:\n if s != tmp:\n cnt += 1\n tmp = s\n\n print(cnt - 1)", "main", "S = input()", "S", "input()", "input", "cnt = 0", "cnt", "0", "tmp = \"\"", "tmp", "\"\"", "for s in S:\n if s != tmp:\n cnt += 1\n tmp = s\n\n ", "s", "S", "if s != tmp:\n cnt += 1\n ", "s != tmp", "s", "tmp", "cnt += 1", "cnt", "1", "tmp = s", "tmp", "s", "print(cnt - 1)", "print", "cnt - 1", "cnt", "1", "if __name__ == \"__main__\":\n main()", "__name__ == \"__main__\"", "__name__", "\"__main__\"", "main()", "main", "def main():\n S = input()\n cnt = 0\n tmp = \"\"\n for s in S:\n if s != tmp:\n cnt += 1\n tmp = s\n\n print(cnt - 1)", "def main():\n S = input()\n cnt = 0\n tmp = \"\"\n for s in S:\n if s != tmp:\n cnt += 1\n tmp = s\n\n print(cnt - 1)", "main" ]
import collections def main(): S = input() cnt = 0 tmp = "" for s in S: if s != tmp: cnt += 1 tmp = s print(cnt - 1) if __name__ == "__main__": main()
[ 7, 0, 13, 4, 13, 0, 13, 18, 13, 17, 0, 13, 17, 28, 13, 18, 13, 39, 17, 14, 40, 13, 13, 0, 13, 17, 0, 13, 13, 4, 13, 13, 10, 17, 13, 10, 13, 13, 10, 4, 13, 10, 18, 13, 10, 17, 13 ]
[ [ 39, 2 ], [ 42, 6 ], [ 40, 8 ], [ 33, 11 ], [ 15, 14 ], [ 40, 16 ], [ 14, 21 ], [ 43, 22 ], [ 37, 22 ], [ 45, 24 ], [ 36, 27 ], [ 14, 28 ], [ 46, 31 ], [ 34, 31 ], [ 33, 34 ], [ 14, 36 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ], [ 45, 46 ] ]
[ "S = input()\ncolor = S[0]\ncnt = 0\nfor i in S[1:]:\n if i != color:\n cnt += 1\n color = i\nprint(cnt)", "S = input()", "S", "input()", "input", "color = S[0]", "color", "S[0]", "S", "0", "cnt = 0", "cnt", "0", "for i in S[1:]:\n if i != color:\n cnt += 1\n color = i", "i", "S[1:]", "S", "1:", "1", "if i != color:\n cnt += 1\n color = i", "i != color", "i", "color", "cnt += 1", "cnt", "1", "color = i", "color", "i", "print(cnt)", "print", "cnt", "cnt = 0", "0", "cnt", "color = i", "i", "color", "S = input()", "input()", "S", "color = S[0]", "S[0]", "color", "cnt += 1", "1", "cnt" ]
S = input() color = S[0] cnt = 0 for i in S[1:]: if i != color: cnt += 1 color = i print(cnt)
[ 7, 0, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 36, 2 ], [ 39, 6 ], [ 10, 9 ], [ 37, 15 ], [ 37, 19 ], [ 9, 20 ], [ 37, 22 ], [ 9, 24 ], [ 33, 27 ], [ 34, 31 ], [ 40, 31 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ] ]
[ "s = input()\ncnt = 0\nfor i in range(1,len(s)):\n if s[i] != s[i-1]: \n cnt += 1\nprint(cnt)", "s = input()", "s", "input()", "input", "cnt = 0", "cnt", "0", "for i in range(1,len(s)):\n if s[i] != s[i-1]: \n cnt += 1", "i", "range(1,len(s))", "range", "1", "len(s)", "len", "s", "if s[i] != s[i-1]: \n cnt += 1", "s[i] != s[i-1]", "s[i]", "s", "i", "s[i-1]", "s", "i-1", "i", "1", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "cnt += 1", "1", "cnt", "s = input()", "input()", "s", "cnt = 0", "0", "cnt" ]
s = input() cnt = 0 for i in range(1,len(s)): if s[i] != s[i-1]: cnt += 1 print(cnt)
[ 7, 0, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 2, 4, 13, 13, 17, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 42, 2 ], [ 39, 8 ], [ 12, 11 ], [ 43, 17 ], [ 43, 22 ], [ 11, 23 ], [ 43, 25 ], [ 11, 27 ], [ 36, 30 ], [ 37, 34 ], [ 40, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ] ]
[ "S = str(input())\nSum = 0 \nfor i in range(len(S) - 1):\n if S[i] != S[i + 1]:\n Sum += 1\n\nprint(Sum)", "S = str(input())", "S", "str(input())", "str", "input()", "input", "Sum = 0", "Sum", "0", "for i in range(len(S) - 1):\n if S[i] != S[i + 1]:\n Sum += 1", "i", "range(len(S) - 1)", "range", "len(S) - 1", "len(S)", "len", "S", "1", "if S[i] != S[i + 1]:\n Sum += 1", "S[i] != S[i + 1]", "S[i]", "S", "i", "S[i + 1]", "S", "i + 1", "i", "1", "Sum += 1", "Sum", "1", "print(Sum)", "print", "Sum", "Sum += 1", "1", "Sum", "Sum = 0", "0", "Sum", "S = str(input())", "str(input())", "S" ]
S = str(input()) Sum = 0 for i in range(len(S) - 1): if S[i] != S[i + 1]: Sum += 1 print(Sum)
[ 7, 0, 13, 4, 13, 4, 13, 4, 13, 0, 13, 17, 28, 13, 4, 13, 17, 4, 13, 13, 14, 40, 18, 13, 13, 18, 13, 2, 13, 17, 0, 13, 17, 4, 13, 13, 10, 17, 13, 10, 17, 13, 10, 4, 13 ]
[ [ 43, 2 ], [ 40, 10 ], [ 14, 13 ], [ 44, 19 ], [ 44, 23 ], [ 13, 24 ], [ 44, 26 ], [ 13, 28 ], [ 37, 31 ], [ 38, 35 ], [ 41, 35 ], [ 37, 38 ], [ 40, 41 ], [ 43, 44 ] ]
[ "lst=list(str(input()))\ncnt=0\nfor i in range(1, len(lst)):\n if lst[i]!=lst[i-1]:\n cnt+=1\nprint(cnt)", "lst=list(str(input()))", "lst", "list(str(input()))", "list", "str(input())", "str", "input()", "input", "cnt=0", "cnt", "0", "for i in range(1, len(lst)):\n if lst[i]!=lst[i-1]:\n cnt+=1", "i", "range(1, len(lst))", "range", "1", "len(lst)", "len", "lst", "if lst[i]!=lst[i-1]:\n cnt+=1", "lst[i]!=lst[i-1]", "lst[i]", "lst", "i", "lst[i-1]", "lst", "i-1", "i", "1", "cnt+=1", "cnt", "1", "print(cnt)", "print", "cnt", "cnt+=1", "1", "cnt", "cnt=0", "0", "cnt", "lst=list(str(input()))", "list(str(input()))", "lst" ]
lst=list(str(input())) cnt=0 for i in range(1, len(lst)): if lst[i]!=lst[i-1]: cnt+=1 print(cnt)
[ 7, 0, 13, 4, 13, 4, 13, 2, 4, 18, 13, 13, 17, 4, 18, 13, 13, 17, 10, 4, 13 ]
[ [ 19, 2 ], [ 20, 10 ], [ 20, 15 ], [ 19, 20 ] ]
[ "S = input()\nprint(S.count('BW')+S.count('WB'))", "S = input()", "S", "input()", "input", "print(S.count('BW')+S.count('WB'))", "print", "S.count('BW')+S.count('WB')", "S.count('BW')", "S.count", "S", "count", "'BW'", "S.count('WB')", "S.count", "S", "count", "'WB'", "S = input()", "input()", "S" ]
S = input() print(S.count('BW')+S.count('WB'))
[ 7, 0, 13, 4, 13, 0, 13, 17, 0, 13, 18, 13, 17, 28, 13, 13, 14, 40, 13, 13, 0, 13, 13, 0, 13, 17, 4, 13, 13, 10, 13, 13, 10, 17, 13, 10, 18, 13, 10, 4, 13, 10, 17, 13 ]
[ [ 39, 2 ], [ 42, 6 ], [ 36, 9 ], [ 40, 11 ], [ 15, 14 ], [ 40, 14 ], [ 14, 18 ], [ 37, 19 ], [ 31, 19 ], [ 30, 21 ], [ 14, 22 ], [ 33, 24 ], [ 34, 28 ], [ 43, 28 ], [ 14, 30 ], [ 30, 31 ], [ 33, 34 ], [ 36, 37 ], [ 39, 40 ], [ 42, 43 ] ]
[ "S = input()\ncnt = 0\nnow = S[0]\n\nfor i in S:\n if i != now:\n now = i\n cnt += 1\nprint(cnt)", "S = input()", "S", "input()", "input", "cnt = 0", "cnt", "0", "now = S[0]", "now", "S[0]", "S", "0", "for i in S:\n if i != now:\n now = i\n cnt += 1", "i", "S", "if i != now:\n now = i\n cnt += 1", "i != now", "i", "now", "now = i", "now", "i", "cnt += 1", "cnt", "1", "print(cnt)", "print", "cnt", "now = i", "i", "now", "cnt += 1", "1", "cnt", "now = S[0]", "S[0]", "now", "S = input()", "input()", "S", "cnt = 0", "0", "cnt" ]
S = input() cnt = 0 now = S[0] for i in S: if i != now: now = i cnt += 1 print(cnt)
[ 7, 0, 13, 4, 13, 0, 13, 39, 0, 13, 17, 28, 13, 13, 14, 2, 13, 17, 4, 18, 13, 13, 13, 0, 13, 13, 14, 2, 13, 13, 4, 18, 13, 13, 13, 0, 13, 13, 4, 13, 2, 4, 13, 13, 17, 10, 4, 13, 10, 39, 13, 10, 13, 13, 10, 17, 13, 10, 13, 13 ]
[ [ 46, 2 ], [ 49, 6 ], [ 55, 9 ], [ 13, 12 ], [ 47, 12 ], [ 56, 16 ], [ 59, 16 ], [ 53, 16 ], [ 50, 20 ], [ 12, 22 ], [ 52, 24 ], [ 12, 25 ], [ 56, 28 ], [ 59, 28 ], [ 53, 28 ], [ 12, 29 ], [ 50, 32 ], [ 12, 34 ], [ 58, 36 ], [ 12, 37 ], [ 50, 43 ], [ 46, 47 ], [ 49, 50 ], [ 12, 52 ], [ 52, 53 ], [ 55, 56 ], [ 12, 58 ], [ 58, 59 ] ]
[ "s = input()\nS = []\nb = \"\"\nfor i in s:\n if b == \"\":\n S.append(i)\n b = i\n elif b == i: continue\n else:\n S.append(i)\n b = i\nprint(len(S)-1)", "s = input()", "s", "input()", "input", "S = []", "S", "[]", "b = \"\"", "b", "\"\"", "for i in s:\n if b == \"\":\n S.append(i)\n b = i\n elif b == i: continue\n else:\n S.append(i)\n b = i", "i", "s", "if b == \"\":\n S.append(i)\n b = i\n elif b == i: continue\n else:\n S.append(i)\n b = i", "b == \"\"", "b", "\"\"", "S.append(i)", "S.append", "S", "append", "i", "b = i", "b", "i", "elif b == i: continue\n ", "b == i", "b", "i", "S.append(i)", "S.append", "S", "append", "i", "b = i", "b", "i", "print(len(S)-1)", "print", "len(S)-1", "len(S)", "len", "S", "1", "s = input()", "input()", "s", "S = []", "[]", "S", "b = i", "i", "b", "b = \"\"", "\"\"", "b", "b = i", "i", "b" ]
s = input() S = [] b = "" for i in s: if b == "": S.append(i) b = i elif b == i: continue else: S.append(i) b = i print(len(S)-1)