我有以下字符串:
text_one = str("\"A Ukrainian American woman who lives near Boston, Massachusetts, told Fox News Digital on Monday that she can no longer speak on the phone with her own mother, who lives in southern Ukraine, because of the Russian attacks on Ukraine and the fear these attacks have engendered.")
text_two = str("\n\nMany people in southern Ukraine — as well as throughout the country — are right now living in fear for their lives as Russian soldiers overtake the area, the Boston-area woman said.\"")
我需要用$替换每个s/s实例,但要替换给定单词中的first个s/s实例.因此,输入/输出如下所示:
> Mississippi
> Mis$i$$ippi
我的 idea 是,在每个字符之后,先跳过"s",然后替换所有其他字符,直到"character",但我不知道该怎么做.我还考虑创建一个列表来处理每个单词.