HackerRank Tweets

Sort by

recency

|

103 Discussions

|

  • + 0 comments

    public class Solution {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        int validTweet = 0;
        for(int i = 0; i < n; i++) {
            String tweet = scanner.nextLine().toLowerCase();
            if(tweet.contains("hackerrank")) {
                validTweet++;
            }  
        }
        System.out.println(validTweet);
        scanner.close();
    
    }
    

    }

  • + 0 comments

    it's not that complicated lol

    console.log(input.match(/hackerrank/gmi).length)
    
  • + 0 comments

    import re

    txt='' for _ in range(int(input())): txt+=input()+" "

    pat=r"hackerrank" print(len(re.findall(pat,txt.lower()))) `

  • + 0 comments
    import re
    
    n = int(input())
    count = 0
    for _ in range(n):
        tweet = input()
        if re.search(r"hackerrank", tweet, re.IGNORECASE):
            count += 1
    print(count)
    
  • + 0 comments

    python 3

    import re pattern = re.compile(r'\w*[#@]?(hackerrank)\w*',re.IGNORECASE)

    n =int(input()) count = 0

    for _ in range(n): text = input() if re.search(pattern, text): count = count + 1 print(count)