finish choose next pattern and find max count patterns