The Type Sniffer
Peregrine Analytics loads spreadsheets whose columns arrive untyped — every value is just text until something decides what it is. The loader labels each value before storing it, and the rule it applies is a cascade, tried strictly in this order. A value is a whole number when it is made of digits and nothing else, apart from at most one minus sign in front of them. Failing that, it is a decimal number if it can be read as one. Anything still left over is text.
Task: Print the type of each value.
Input
The first line holds one integer n, how many values follow. Each of the next n lines holds one value exactly as it appeared in the file, with no surrounding spaces. Values may be negative, may use scientific notation such as 1e3, and may be ordinary words. They may also carry a leading plus sign or an underscore between digits, as in +5 and 1_000; neither of those is made of digits alone, so neither satisfies the whole-number rule.
Output
n lines in the same order, each holding exactly one of the lowercase words int, float or text.
Example:
Input:
4
42
-7
3.14
hello
Output:
int
int
float
text
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in