Think about how you would do it manually: you would start at the left and look at each value until you found a 5. Then you would add each digit after that to a new piece of paper until you found a 6.
The new sheet of paper then contains the data you are looking for.
Then think about computerising it: you need a collection you can add to, a loop to look at individual characters, and a flag which tells you if you are looking for a 5 or a 6. if it's set to "start" then you look for a 5, if it's set to "end" you are copying up to a six.
If you are having problems getting started at all, then this may help:
How to Write Code to Solve a Problem, A Beginner's Guide[
^]