struct ListNode *getIntersectionNode(struct ListNode *headA, struct ListNode *headB) {struct ListNode *tailA=headA;struct ListNode *tailB=headB;int count1=0;int count2=0;while(tailA){tailA=tailA->next;count1++;}while(tailB){tailB=tailB->next;count2++;}if(tailA!=tailB)return NULL;int tmp=abs(count1-count2);struct ListNode*longList=headA;struct ListNode*shortList=headB;if(count2>count1){longList=headB;shortList=headA;}while(tmp){longList=longList->next;tmp--;}while(longList!=shortList){shortList=shortList->next;longList=longList->next;}return longList;
}