#TI-Basic (TI-84 Plus CE), 131 bytes
TI-Basic (TI-84 Plus CE), 131 bytes
Prompt Str0
inString(Str0," →A
length(Str0)–A→L
sub(Str0,A,L→Str0
" →Str2
For(B,1,L
sub(Str0,B,1)+Str2→Str2
End
inString(Str2," →A
L-A→L
sub(Str2,A,L→Str2
" →Str0
For(B,1,L
sub(Str2,B,1)+Str0→Str0
End
Disp Str0
Explanation:
Prompt Str0 # 4 bytes, input user string
inString(Str0," →A # 10 bytes, store the index of the first space in A
length(Str0)–A→L # 10 bytes, store the length of the string (after removing the first A characters) in L
sub(Str0,A,L→Str0 # 12 bytes, remove first A-1 and last characters of Str0
" →Str2 # 6 bytes, temporary string to reverse Str0
For(B,1,L # 7 bytes, reverse Str0 into Str2
sub(Str0,B,1)+Str2→Str2 # 16 bytes
End # 2 bytes
inString(Str2," →A # 10 bytes, store the index of the first space in A
L-A→L # 6 bytes, get new length
sub(Str2,A,L→Str2 # 12 bytesremove first A-1 and last characters of Str2
" →Str0 # 6 bytes, temporary string to reverse Str2
For(B,1,L # 7 bytes, reverse Str2 into Str0
sub(Str2,B,1)+Str0→Str0 # 16 bytes
End # 2 bytes
Disp Str0 # 3 bytes, display final string with (2 trailing spaces)