#include <iostream>
#include <vector>
#include <algorithm>
int main ()
{
std::vector<int> v = { 5, 2, 1, 3, 3, 7, 1, 5, 9, 9, 9, 4, 4 };
std::vector<int>::iterator it;
it = std::adjacent_find(v.begin(), v.end());
if (it != v.end())
it = std::adjacent_find(++it, v.end());
if (it != v.end())
std::cout << "The second pair of repeated elements start with: " << *it << '\n';
return 0;
}
/*
run:
The second pair of repeated elements start with: 9
*/