Detect Integer or Float

Detect Integer or Float

Easy PHP PHP Data Types 26 views
Explanation Complexity

Problem Statement

A number is given as text. Print INT if it looks like an integer, otherwise FLOAT.

Input Format

One token s.

Output Format

INT or FLOAT.

Example

12.50
FLOAT

Constraints

s length

Input / Output Format

Input Format
One token s.
Output Format
INT or FLOAT.
Constraints
s length

Examples

Input:
12.50
Output:
FLOAT

Example Solution (Public)

PHP
<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
if(preg_match('/[\\.eE]/',$inputText)) echo 'FLOAT'; else echo 'INT';
?>

Official Solution Code

<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
if(preg_match('/[\\.eE]/',$inputText)) echo 'FLOAT'; else echo 'INT';
?>
Please login to submit solutions.
Editor
Output

                                        
Please login to submit solutions.