Given three strings A, B and C your task is to complete the function **isInterleave** which returns true if C is an interleaving of A and B else returns false. C is said to be interleaving A and B, if it contains all characters of A and B and order of all characters in individual strings is preserved.

**Input:**

The first line of input contains an input T denoting the no of test cases. Then T test cases follow. Each test case contains three space separated strings A, B, C.

**Output:**

For each test case output will be 1 if C is interleaving of string A and B else 0.

**Constraints:**

1<=T<=100

1<=length of A, B, C <=100

**Example(To be used only for expected output):
Input:**

2

YX X XXY

XY X XXY

0

1

1. For first test case XXY is not interleaving of YX and X

2. For the sec test case XXY is interleaving of XY and X.

Author: Shubham Joshi 1

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

saiujwal13083 | 347 |

isiddhisingh | 252 |

Abhishek_Jadhav | 243 |

_uncle_sam_ | 221 |

c_ocoooo | 217 |

saiujwal13083 | 610 |

SumitSingh27 | 466 |

c_ocoooo | 456 |

rathiarpit29 | 379 |

NaveenKumarNakka | 370 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4931 |

Quandray | 4598 |

Login to report an issue on this page.