#ABC143C. Slimes

Slimes

题目描述

There are NN slimes lining up from left to right. The colors of these slimes will be given as a string SS of length NN consisting of lowercase English letters. The ii-th slime from the left has the color that corresponds to the ii-th character of SS.

Adjacent slimes with the same color will fuse into one larger slime without changing the color. If there were a slime adjacent to this group of slimes before fusion, that slime is now adjacent to the new larger slime.

Ultimately, how many slimes will be there?

有 NN 个史莱姆从左到右排成一行。这些史莱姆的颜色将以长度为 NN 的字符串 SS 的形式给出,字符串由小写英文字母组成。从左边开始的 ii 个史莱姆的颜色与 SS 的 ii 个字符相对应。

相邻的相同颜色的粘液会融合成一个更大的粘液,而不会改变颜色。如果在融合前这组粘液的旁边有一个粘液,那么现在这个粘液就会和新的更大的粘液相邻。

最终会有多少个史莱姆?

输入格式

输入内容按以下格式标准输入:

NN
SS

输出格式

打印史莱姆的最终数量。

样例 #1

样例输入 #1

10
aabbbbaaca

样例输出 #1

5

样例 #2

样例输入 #2

5
aaaaa

样例输出 #2

1

样例 #3

样例输入 #3

20
xxzaffeeeeddfkkkkllq

样例输出 #3

10

说明

数据规模与约定

  • 1≤N≤1051 \leq N \leq 10^5
  • ∣S∣=N|S| = N
  • SS 由小写英文字母组成。

样例 11 解释

最终,这些粘液将融合成abaca。

样例 22 解释

所有粘液将融为一体