In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of October 25th
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #03 exercise sheet]


In this problem you should submit a function as described. Inside the function do not print anything that was not asked!

The name of the .py source file you submit to Mooshak should NOT start with a digit (you will get an error if you submit it like that).

[IP030] Numerus Maximus!

Sarah seeks to unlock the ancient spell of Numerus Maximus, a powerful incantation that reveals the longest ascending sequence of digits in a number. Can you help her unveil this numeric enchantment?

The Problem

Write a function largest_sequence(num) that takes an integer num and returns the length of the longest (contiguous) sequence of digits that are in strictly increasing order.

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

0 ≤ num ≤ 1050       The integer from which to fing the longest ascending sequence

Example Function Calls Example Output
print(largest_sequence(129643457))
print(largest_sequence(1213478911))
print(largest_sequence(123123412345))
4
6
5

Introduction to Programming (CC1024)
DCC/FCUP - University of Porto