Home
Learn
Practice
Contests
Rankings
Log In
Sign Up
Log In
Sign Up
Forgot Password ?
New password will be sent to following email id
Chotu vs Motu
All Submissions
Problem Code : CVM
Description
Input Format
Output Format
Constraints
Sample Input
2 (1/1) / (2/2) (4/5) / (2/3)
Sample Output
1 1 6 5
Explanation
Author :
psyduck
Time Limit :
2 secs
Editorial :
codebuddy.com/problems/CVM/editorial
Languages :
C , C++ , Java , Python 2
Login to submit your response.
A battle of rational expression is going on b/w chotu and Motu. Motu gives chotu a rational expression in the form <b>(a/b) / (c/d) </b>. Now chotu has to return the answer in the simplest form. <br><br> <b>Source - Flipkart Intern 2016</b>
First line of each input contains a single integer <b>T</b> denoting number of test cases.<br> Each of next <b>T</b> lines contains a string denoting the given expression.
Print <b>T</b> lines, in each of the line print two space separated integers <b>x</b>, <b>y</b> denoting <b>numerator</b> and <b>denominator</b> of the simplified expression.
1 ≤ <b>T</b> ≤ 100<br> 1 ≤ <b>a,b,c,d</b> ≤ 1000