Max Using Ternary

Max Using Ternary

Easy PHP PHP Operators 29 views
Explanation Complexity

Problem Statement

Print the bigger of two integers using a ternary expression.

Input Format

One line: a b.

Output Format

One integer max.

Example

5 9
9

Constraints

-10^9

Input / Output Format

Input Format
One line: a b.
Output Format
One integer max.
Constraints
-10^9

Examples

Input:
5 9
Output:
9

Example Solution (Public)

PHP
<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
[$a,$b]=array_map('intval',preg_split('/\\s+/', $inputText));
$mx=($a>$b)?$a:$b;
echo $mx;
?>

Official Solution Code

<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
[$a,$b]=array_map('intval',preg_split('/\\s+/', $inputText));
$mx=($a>$b)?$a:$b;
echo $mx;
?>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.