6

GTB, 25 24 26 characters
0→X`_[@_="1":X+1→X@_≠"]~X
Explanation
0→X Put 0 in X (remember GTB adds a colon at the front of every program)
`_ Input into string _
[ Start loop
@_="1" Test if case is finished, if so X+1→X
@_≠" If not empty, keep looping
~X After finished, display X