题目地址:https://vjudge.net/problem/CodeForces-266A
题目分析:定义好石头个数后,直接利用后一个和前一个的关系做,两个两个比较即可。
#include
using namespace std;
int main()
{
int n,x=0;
cin >> n;
char *p;
p = new char[n];
cin >> p;
for (int i = 0; i < n; i++)
{
if (p[i] == p[i + 1])x++;
}
cout << x;
delete[]p;
p = NULL;
}