string = input("请输入字符串:")
vowels = "aeiouAEIOU"
new_string = ""
for char in string:
    if char in vowels:
        new_string += chr(ord(char) + 1)
    else:
        new_string += char
print("替换后的字符串为:", new_string)

示例输出:

请输入字符串:Hello World
替换后的字符串为: Hfmmp Xpsme
编写一个程序输出入一个字符串将其中所有的元音子母替换为他们的后一个字母

原文地址: https://www.cveoy.top/t/topic/cFvf 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录