Hehe

There is a Chinese joke: “Chat ends with hehe”. Given a chat log, count how many conversations end with a sentence containing the word “hehe” (or variations, see below). To check whether the sentence contains “hehe”, first replace any non-alphabetic characters with spaces, convert the characters to lower-case and extract a list of words. For example, “Hi! Are you OK?” becomes a list of 4 words: hi, are, you, ok. Note that the list of words could be empty. Note that some people prefer to use “hehehe” or “hehehehe” instead of “hehe”, so a word formed by n (n > 1) copies of “he” should be regarded as a variation of “hehe”. However, there are some other words which contain “hehe” as a consecutive substring. Don’t consider them! Input There is only one test case. Each line is a record formatted as N ame1->N ame2: sentence Each line will have at most 1000 characters, and there will be at most 100 lines. Output Print the percentage (rounded to the nearest integer) of conversations ended with ”hehe” or its variants. The test data will be carefully chosen so that the answer will not be equally near to two integers. Explanation Converstation between A and B ends with “Hehe”. Converstation between A and C ends with “Are you there?”. Converstation between B and D ends with “What does hehehei mean?”. Converstation between E and F ends with “I want to hehehehehe yah”. Only the first one and the last one ends with ”hehe” (and variants), so the answer is 50%. Sample Input A->B: Hello! A->C: Hi! B->A: Hehe B->D: Hei! D->B: How are you? A->C: Hi??? A->C: Are you there? B->D: Hehehei! D->B: What does hehehei mean? F->E: I want to hehehehehe yah. Sample Output 50% Problemsetter: Rujia Liu, Special Thanks: Md. Mahbubul Hasan, Feng Chen