#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
    typedef std::vector<int> vec_type;

    vec_type numbers { 10, 10, 20, 20, 20, 30, 30, 30, 40, 30, 10, 10 };
    
    auto it = std::begin(numbers);

    while ((it = std::adjacent_find(it, std::end(numbers))) != std::end(numbers))
    {
        auto value = *it;
        unsigned matches = 1;

        while (++it != std::end(numbers) && *it == value)
            ++matches;
       
        std::cout << value << ": " << matches << " matches.\n" ;
    }
}