Even slightly shorter:
10 A$="manuel-san wa ichiban ookii hito desu" 20 A=INSTR(A$," "):IFATHENA$=LEFT$(A$,A-1)+MID$(A$,A+1):GOTO20 30 PRINTA$
Or this version which is slightly longer, but uses a FOR/NEXT loop instead of a GOTO statement. This means it doesn't need its own line, which could be useful for 10-line BASIC contests etc:
10 A$="manuel-san wa ichiban ookii hito desu":FORA=1TO0STEP-1:A=INSTR(A$," "):A$=LEFT$(A$,A+(A>0))+MID$(A$,A+1):NEXT:PRINTA$
I don't think I have anything to add here So their strategy is to 'eat' the string.
Thanks guys! And indeed, alter A$ is the way to go. Learnt something. Great!
It's the way to go for the shortest implementation, but probably not for the fastest... The string is copied around a lot like this...
Se logue ou se registre para poder enviar comentários