Will she accept him?

 Problem:-

A love Guru determines “whether a guy’s proposal is going to be accepted by his crush or not” just by doing some mysterious calculation on their names, but it takes too much time for him. So, he hired you as a programmer and now your task is to write a program that helps the Guru.

He reveals his mystery with you and that is:

If the guy’s name is a subsequence of his crush’s name, then she is going to accept him, otherwise she will reject him.

Input

First line contains T, the number of test cases.
Next T lines contain two strings S1 and S2 which are the guy’s name and his crush’s name respectively.

Output

For each test case, according to Guru’s mystery, if the crush is going to accept the guy then print “Love you too”, otherwise print “We are only friends”.

Constraints

strings contain only lowercase Latin letters. 

    

1T60

    

1len(S1),len(S2)100000

 

 

 

 

Sample Input
4
kalyan nobodyintheworld
rahul allgirlsallhunontheplanet
physicsguy nobodynobodylikesitbetter
lal llaggyel
Sample Output
We are only friends
Love you too
We are only friends
Love you too
Time Limit: 1
Memory Limit: 256
Source Limit:

Code:-

#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  string s1,s2;
  while(n–)
  {
    cin>>s1>>s2;
    int j=0;
    int l;
    l=s1.length();
    for(int i=0;s2[i];i++)
    {
      if(s2[i]==s1[j])
      {
        j++;
      }
      if(j==l1)
       break;
    }
    if(j==l1)
     cout<<“Love you too”<<endl;
    else
     cout<<“We are only friends”<<endl;
  }
  return 0;
}



Leave a Reply

Your email address will not be published.