The answer code that Lara showed me in Practice Programming No. 2 may not be as expected if input2 has a string longer than input1.
For example, when inputting aa in input1 and aabcd in input2, the termination condition of the iteration is until input1, so if it is compared to the second digit and ends, the first two letters are the same, the sentence 'Two strings are the same.'
To solve this problem, we can add another if statement in the first if statement to compare whether the value of input2[i] is also \0, and if \0 then break; if \0 then same = false; then break;.