最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

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

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

找到相鄰元素相同的個(gè)數(shù)即可。

下面是代碼;


CF 266A - Stones on the Table的評論 (共 條)

分享到微博請遵守國家法律
安阳县| 美姑县| 盘锦市| 珠海市| 寻甸| 宿迁市| 自贡市| 永吉县| 铜梁县| 台北市| 灌云县| 霍林郭勒市| 积石山| 邳州市| 牙克石市| 余姚市| 贡山| 调兵山市| 磐安县| 大港区| 白山市| 泗阳县| 健康| 循化| 睢宁县| 紫金县| 宾阳县| 平远县| 卢氏县| 大丰市| 巴彦淖尔市| 义乌市| 莱西市| 青铜峡市| 皋兰县| 瓮安县| 潮州市| 龙门县| 慈溪市| 台州市| 屯昌县|