AtCoder Beginner Contest 143
翻译中…
Problem Statement
翻译中…
There are $N$ slimes lining up from left to right. The colors of these slimes will be given as a string $S$ of length $N$ consisting of lowercase English letters. The $i$-th slime from the left has the color that corresponds to the $i$-th character of $S$.
翻译中…
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?
翻译中…
Constraints
翻译中…
$1 \leq N \leq 10^5$$|S| = N$$S$consists of lowercase English letters.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
S
翻译中…
Output
翻译中…
Print the final number of slimes.
翻译中…
样例
Input #1
10
aabbbbaaca
Output #1
5
Ultimately, these slimes will fuse into `abaca`.
Input #2
5
aaaaa
Output #2
1
All the slimes will fuse into one.
Input #3
20
xxzaffeeeeddfkkkkllq
Output #3
10
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。