Sort by

recency

|

23 Discussions

|

  • + 1 comment
    #!/bin/python3
    
    import math
    import os
    import random
    import re
    import sys
    from collections import Counter
    
    
    if __name__ == '__main__':
    
        # Sample large text
        text = sys.stdin.read()
    
        pattern = r'[\r\n]'
        cleaned_text = re.sub(pattern, '', text)
    
        pattern = r'(?=(\b[a-z]+\s[a-z]+\s[a-z]+\b))'
        # Find all matches
        matches = re.findall(pattern, cleaned_text.lower())
    
        #print(matches)
        # Count the number of matches using Counter
        match_counts = Counter(matches)
    
        #get the first value with highest number
        result = ""
        max_num = 0
    
        for match, count in match_counts.items():
            #print(match, max_num, count)
            if max_num < count:
                result = match
                max_num = count
    
        print(result.strip())
    
  • + 0 comments

    Thanks it very helpful for my site Pearl Lemon Clutch reviews

  • + 0 comments

    FOR PYTHON, USE sys.stdin.read() instead! I REPEAT USE SYS.STDIN.READ(), Or it will f**k up the input. What a waste of ****ing time

  • + 1 comment

    Code is giving me right answer in Notebook but not in Hackerrank IDE? Does anyone know the reason why ?

  • + 0 comments

    check this article to understand trigrams concept and code Generate n_grams without any library