第一期训练题03

点击查看原题

#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	char *p = new char[n];
	cin >> p;
	int t = 0;
	for (int i = 0; i < n - 1; i++)
		if (p[i] == p[i + 1])
			t++;
	cout << t;
	return 0;
}

猜你喜欢

转载自blog.csdn.net/Go_Joe/article/details/84886491