Header Ads Widget

Little jhool and his breakup

Problem:-

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!
Input format:
There's only one line in the input, it contains the message sent by her boyfriend.
Output format:
If she managed to understand his message, print "I love you, too!" - else, print "Let us breakup!"
Constraints:
1 <= Length of message <= 100
Example:
Let's say that the message sent by him is: ahhellolvloe, the answer would be "I love you, too!" since it is possible that by deleting characters, she gets the word love.
Let's say that the message sent by him is: lvoe, the answer would be, "Let us breakup!" because there's no way you could get the word love by only using the delete operation.
PS: You can only perform deletion, on the message sent - you cannot rearrange the words in the message!
SAMPLE INPUT
 
lov3333333asdafajfgnkdfn33333e
SAMPLE OUTPUT
 
I love you, too!
Explanation
You can delete characters to get the word love.
Time Limit:2.0 sec(s) for each input file.
Memory Limit:256 MB
Source Limit:

solution:-

#include<stdio.h>
void main()
{
   char s[100];
   int flag1=0,flag2=0,flag3=0,flag4=0,i,j,k,m;
   scanf("%s",s);
   for(i=0;s[i];i++)
   {
     if(s[i]=='l')
     {
       flag1=1;
       break;
     }
   }
   for(j=i+1;s[j];j++)
   {
     if(s[j]=='o')
     {
       flag2=1;
       break;
     }
   }
   for(k=j+1;s[k];k++)
   {
     if(s[k]=='v')
     {
       flag3=1;
       break;
     }
   }
   for(m=k+1;s[m];m++)
   {
     if(s[m]=='e')
     {
       flag4=1;
       break;
     }
   }
   if(flag1==1&&flag2==1&&flag3==1&&flag4==1)
   printf("I love you, too!");
   else
   printf("Let us breakup!");
}

Post a Comment

1 Comments