In this Leetcode Little Jhool and his breakup problem solution After minting loads of money from innocent people by using the psychic powers (As we saw in the previous question!) - little Jhool managed to woo his girlfriend big Jhool! And now, he's in love - madly, madly in love with his girlfriend.

But the road to love is not easy as they say, little Jhool and big Jhool live in two different cities, and they often have to rely on multiple online clients to communicate. And many times, due to frustration, little Jhool starts hitting his keyboard, pressing the wrong keys - and thus, he ends up sending her a meaningless message, which frustrates his girlfriend - obviously. But big Jhool is a smart girl and she knows what to reciprocate back to her boyfriend's message based on the message she has received from him.

She figures that if and only if, she can delete several characters from the message sent by her boyfriend, resulting in the word "love", it will be considered that she managed to understand his message, and if not... well, some trouble is waiting for her boyfriend!

HackerEarth Little Jhool and his breakup problem solution

HackerEarth Little Jhool and his breakup problem solution.

import re
message = raw_input()
if"l.*o.*v.*e", message):
    print "I love you, too!"
    print "Let us breakup!"

Second solution

#include <stdio.h>

int main(void)
    char ch[150], love[] = "love";
    int len, j = 0;
    int arr[4] = {0};
    // Trick to find length of the input string
    scanf("%s%n", ch, &len);
    for(register int i = 0 ; i < len ; ++i)
        if( arr[j] == 0  && ch[i] == love[j])
            arr[j++] = 1;
    if (j == 4)
        puts("I love you, too!");
        puts("Let us breakup!");
    return 0;