Create Remove_Duplicates_from_Sorted_Array_2

Follow up for "Remove Duplicates":
What if duplicates are allowed at most twice?

For example,
Given sorted array A = [1,1,1,2,2,3],

Your function should return length = 5, and A is now [1,1,2,2,3].(thanks to zhao, 一定要把脑子搞清楚，不要急，有两个指针，哪个是做什么的抓住了)