欢迎光临散文网 会员登陆 & 注册

CF 266A - Stones on the Table

2023-07-22 09:36 作者:您是打尖儿还是住店呢  | 我要投稿

There are n stones on the table in a row, each of them can be red, green or blue. Count the minimum number of stones to take from the table so that any two neighboring stones had different colors. Stones in a row are considered neighboring if there are no other stones between them.

Input

The first line contains integer n (1 ≤ n ≤ 50) — the number of stones on the table.

The next line contains string s, which represents the colors of the stones. We'll consider the stones in the row numbered from 1 to n from left to right. Then the i-th character s equals "R", if the i-th stone is red, "G", if it's green and "B", if it's blue.

Output

Print a single integer — the answer to the problem.

Examples

input

3

RRG

output

1

input

5

RRRRR

output

4

input

4

BRBG

output

0

----------------------------

找到相邻元素相同的个数即可。

下面是代码;


CF 266A - Stones on the Table的评论 (共 条)

分享到微博请遵守国家法律