class Solution:

    def replaceSpaces(self, S: str, length: int) ->str:
        sList = list(S)
        for i in range(length):
            if sList[i] == ' ':
                sList[i] = '%20'
        return ''.join(sList[:length])

daff1a757a84c2701b8be7af696eeb302285fdc9
<mask token>

class Solution:
    <mask token>

class Solution:

    def replaceSpaces(self, S: str, length: int) ->str:
        sList = list(S)
        for i in range(length):
            if sList[i] == ' ':
                sList[i] = '%20'
        return ''.join(sList[:length])
