266A - Stones on the Table Codeforces || Codeforces 266A - Stones on the Table Solution

Problem Name: Stones on the Table
Problem Code: 266A
Judge: Codeforces
Problem link: Stones on the Table
Solution on GitHub: Stones on the Table



Codeforces 266A - Stones on the Table Solution in C++/Cpp

#include <bits/stdc++.h>

int main()
{
    int n, count = 0;
    std::string s;
    std::cin >> n;
    std::cin >> s;
    for (int i = 0; i < n - 1; i++)
    {
        if (s[i] == s[i + 1])
        {
            count++;
        }
    }
    std::cout << count << std::endl;

    return 0;
}







 

Next Post Previous Post
No Comment
Add Comment
comment url