Actually I assume that this is a homework, too. It will not be easy to submit one of these solutions without cheating. And of course your teacher knows this forum also. Nevertheless, it is a funny problem and I think, if you spend the time to find out, how each of the solution works, you will have learned enough for today. But do not expect, that we solve homeworks in general.
S = 'varNameOne';
T(1, 2:end) = lower(S);
T(2, isstrprop(S, 'upper')) = ' ';
T = reshape(T(~~T)), 1, );