# Pyth, 34


Try it [online here][1]. Notice, this has a time (and space) complexity of O(n). Therefore the test case `12345678901234567890` takes too long in the online compiler. Use the offline one instead (1 minute on my laptop). 

This is only my first attempt. There might be some room for improvements. 

First some ideas how my algorithm works. 

- I interpret the input as string and not as a number. 
- Then I create all possible subsets of `[0, 1, 2, ..., len(n-1)]`
- For each of these subsets (lets take `[1, 4, 5]`), I split the input string into part using these numbers. `[input[0:1], input[1, 4], input[4,5], input[5,len(input)]]`. 
- Afterwards I try to convert these numbers into strings. There can be two problems. Pyth (or Python) throws an exception for an empty string, and for a string of numbers starting with `0`. Therefore I use a `try - catch` block (actually infinity loop with an immediate break). If converting was successfully, I add the result to a list `Y`. 
- After I handled all subsets, I filter the list `Y` for results, that are already sorted and print the last one (the last one has the most groups).

Now the detailed explanation: 

                                Implicit: z = input() (z is a String!)
                                          Y = empty list
    FNyUz                       for each subset N of [0, 1, 2, ..., len(z)-1]:

         #                         start try-catch block (actually an infinite loop, 
                                   but the Python implementation uses a try catch. 
          aY                          append to Y:
                    C,+0N+Nlz            zip([0] + N, N + [len(z)])
            m                            map each element d to
              :zhded                     z[d[0]:d[-1]]
             v                           evaluated
                             B        if this didn't throw an exception already, end the infinite loop
                              ) end for loop   

     f    Y      filter Y for elements T, for which
      qSTT           sorted(T) == T
    e            and print the last one (the subsets generated with yUz are sorted 
                 by length, so the last one has the most groups)

  [1]: https://pyth.herokuapp.com/?code=FNyUz%23aYmv%3AzhdedC%2C%2B0N%2BNlzB)efqSTTY&input=100202003&debug=0