输出一行,代表chas的左半区 。
输出一行,代表替换后的字符串。
a b c
a%20%20b%20%20%20%20c
时间复杂度,额外空间复杂度。
s=input() ans='' for i in range(len(s)): if s[i]==' ': ans+='%20' else: ans+=s[i] print(ans)
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题