A sentence is a list of tokens separated by a single space with no leading or trailing spaces. Every token is either a positive number consisting of digits 0-9 with no leading zeros, or a word consisting of lowercase English letters.


	For example, "a puppy has 2 eyes 4 legs" is a sentence with seven tokens: "2" and "4" are numbers and the other tokens such as "puppy" are words.


Given a string s representing a sentence, you need to check if all the numbers in s are strictly increasing from left to right (i.e., other than the last number, each number is strictly smaller than the number on its right in s).

Return true if so, or false otherwise.

&nbsp;
Example 1:

Input: s = "1 box has 3 blue 4 red 6 green and 12 yellow marbles"
Output: true
Explanation: The numbers in s are: 1, 3, 4, 6, 12.
They are strictly increasing from left to right: 1 &lt; 3 &lt; 4 &lt; 6 &lt; 12.


Example 2:

Input: s = "hello world 5 x 5"
Output: false
Explanation: The numbers in s are: 5, 5. They are not strictly increasing.


Example 3:

Input: s = "sunset is at 7 51 pm overnight lows will be in the low 50 and 60 s"
Output: false
Explanation: The numbers in s are: 7, 51, 50, 60. They are not strictly increasing.


&nbsp;
Constraints:


	3 &lt;= s.length &lt;= 200
	s consists of lowercase English letters, spaces, and digits from 0 to 9, inclusive.
	The number of tokens in s is between 2 and 100, inclusive.
	The tokens in s are separated by a single space.
	There are at least two numbers in s.
	Each number in s is a positive number less than 100, with no leading zeros.
	s contains no leading or trailing spaces.


class Solution:
    def areNumbersAscending(self, s):
        nums = re.findall(r'\d+', s)
        return nums == sorted(set(nums), key=int)
// Space Complexity: O(1)
// Time Complexity: O(n)
class Solution {
    public boolean areNumbersAscending(String s) {
        int prev = 0;

        for(String token: s.split(" ")) {
            try {
                int number = Integer.parseInt(token);
                if(number <= prev)
                    return false;
                prev = number;
            }
            catch(Exception e) {}
        }

        return true;
    }
}
class Solution {
public:
    bool areNumbersAscending(string s) {
        s.push_back(' '); // for last number calculation
        int prev = -1;
        string num;
        
        for(int i = 0 ; i < s.size() ; ++i)
        {
            char ch = s[i];
            if(isdigit(ch))
                num += ch;
            else if(ch == ' ' and isdigit(s[i - 1]))
            {
                if(stoi(num) <= prev) // number is not strictly increasing
                    return false;
                prev = stoi(num);
                num = "";
            }
        }
        return true;
    }
};
var areNumbersAscending = function(s) {
    const numbers = [];
    const arr = s.split(" ");
    for(let i of arr) {
        if(isFinite(i)) {
            if(numbers.length > 0 && numbers[numbers.length - 1] >= i) {
                return false;
            }
            numbers.push(+i);
        }
    }
    return true
};
Check if Numbers Are Ascending in a Sentence