Write a function detectAndCountLoop() that checks whether a given Linked List contains loop and if loop is present then returns count of nodes in loop. For example, the loop is present in below-linked list and length of the loop is 4. If the loop is not present, then the function should return 0.
Find the length of loop in linked list : https://www.geeksforgeeks.org/find-length-of-loop-in-linked-list/