2018-12-07acm第三题
2018-12-07 本文已影响0人
林锦天
#include<iostream>
using namespace std;
int main()
{
int a;
cin >> a;
char b[50];
b[a] = '\0';
int c=0;
cin >> b;
for (int i = 0; i < a-1; i++)
{
if (b[i] == b[i + 1])
c++;
}
cout << c;
}
#include<iostream>
using namespace std;
int main()
{
int a;
cin >> a;
char b[50];
b[a] = '\0';
int c=0;
cin >> b;
for (int i = 0; i < a-1; i++)
{
if (b[i] == b[i + 1])
c++;
}
cout << c;
}