Template in C++ is a feature. We write code once and use it for any data type including user defined data types.

Given three cases :

1st case when two strings are given , print the smallest of the two strings.

2nd case when two integers are given, print the smallest of the two integers.

3rd case when two char are given , print the smallest of the two characters(lowercase).

Your task is to complete class minElement which would include a private variable say y, a constructor which would set the given value to the private variable. And a method check() which would take one parameter say x and print the min of x and y(private variable) .

**Input: **

The first line will contain an integer **T **(number of test cases). First line of each test case will contain 1 integer **c. **Next line will contain two strings if c is equal to 1 or will contain two integers if c is equal to 2 or will contain two char if value of c is equal to 3.

**Output: **

Print the lowest of the two values given.

**Constraints: **

1 < = **T** < = 100

1 < = **c** < = 3

1<= Length of strings, integers<=10^{3}

**Example:
Input:**

3

1

gfg spl

2

5 9

3

p s

**Output:**

gfg

5

p

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.

bruceewayne | 119 |

rajupraaa1234 | 110 |

SUZAKU | 104 |

yash_sharan | 104 |

Core_Ka_Bachha | 99 |

mr_kksparrow | 433 |

manvirag982 | 302 |

rajupraaa1234 | 245 |

Exception_404 | 244 |

snow_den_ | 236 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.