...

/

Is String a Valid Number?

Is String a Valid Number?

Given an input string, determine if it makes a valid number or not.

Statement

Given an input string, determine if a given string makes a valid number or not.

Notes:

  • For simplicity, assume that white spaces are not present in the input.
  • In case the input string is empty, the function should return TRUE.

Example

Input string

Validity

4.325

Valid number

1.1.1

Not a valid number

222

Valid number

22.

Not a valid number

0.1

Valid number

22.22.

Not a valid number

1.

Not a valid number

Example 1

Sample input

4.325

Expected output

true

Example 2

Sample input

1.1.1

Expected output

false

Try it yourself