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