'What's wrong in my MIPS code about merge all separate input into a string?

.data
        string: .space 256
        temp:   .space 4

.text
        la $t0, string
input:  
        li $v0, 8
        la $a0, temp
        li $a1, 4
        syscall
        
        beq $a0, '=', print
        lb $s0, 0($a0)
        sw $s0, ($t0)   
        addi $t0, $t0, 4
        bne $s0, '=', input
    
print:
        li $v0,4
        la $a0, string
        syscall
    
end:
        li $v0, 10
        syscall

I can only store the first character of my input, but I want to store every single input.

input example:
6
+
2
*
3
=

what I want to store in string:
6+2*3=

what I actually store in string:
6



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source