Skip to content
Programming101
Programming101

Learn everything about programming

  • Home
  • CS Subjects
    • IoT – Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programming101
Programming101

Learn everything about programming

HackerEarth Little Jhool and his breakup problem solution

YASH PAL, 31 July 2024
In this HackerEarth 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 re.search("l.*o.*v.*e", message):
print "I love you, too!"
else:
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!");
else
puts("Let us breakup!");
return 0;
}
coding problems

Post navigation

Previous post
Next post
  • HackerRank Separate the Numbers solution
  • How AI Is Revolutionizing Personalized Learning in Schools
  • GTA 5 is the Game of the Year for 2024 and 2025
  • Hackerrank Day 5 loops 30 days of code solution
  • Hackerrank Day 6 Lets Review 30 days of code solution
©2025 Programming101 | WordPress Theme by SuperbThemes