In the first for-loop, then initializes and finds the longest string and puts it at index 0. The second for-loop checks for any other smaller strings in the list and removes it then displays. The output is right according to the condition but it still doesn't satisfy it.