Wednesday, May 11, 2016

CODEFORCES problem 266/A Stones on the Table

Problem link (Click here)

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

int main()
{
    string stone ;
    int count= 0;
    int n;
    cin >>n >> stone;
    for(int i = 1; i < n; i++ ){
        if(stone[i]==stone[i-1])
            count++;
    }

    cout << count << endl;
    return 0;
}

No comments:

Post a Comment