C # implementation of the approach
using System ; using System . Collections . Generic ; class GFG { static int MAX_SIZE = 100005 , MAX_CHAR = 26 ; static int [ , ] nodecharsCount = new int [ MAX_SIZE , MAX_CHAR ] ; static List < int > [ ] tree = new List < int > [ MAX_SIZE ] ;