Loading Now

longestDigitsPrefix

Given a string, output its longest prefix which contains only digits.

Example

For inputString = "123aa1", the output should be longestDigitsPrefix(inputString) = "123".

Input/Output

  • [execution time limit] 0.5 seconds

  • [input] string s

    Guaranteed constraints:
    3 ≤ inputString.length ≤ 100.

  • [output] string

Post Comment

Contact