A Plan for the Improvement of English Spelling
For example, in Year 1 that useless letter "c" would be dropped to be replased either by "k" or "s", and likewise "x" would no longer be part of the alphabet. The only kase in which "c" would be retained would be the "ch" formation, which will be dealt with later.
Year 2 might reform "w" spelling, so that "which" and "one" would take the same konsonant, wile Year 3 might well abolish "y" replasing it with "i" and Iear 4 might fiks the "g/j" anomali wonse and for all.
Jenerally, then, the improvement would kontinue iear bai iear with iear 5 doing awai with useless double konsonants, and iears 6-12 or so modifaiing vowlz and the rimeining voist and unvoist konsonants.
Bai Iear 15 or sou, it wud fainali bi posibl tu meik ius ov thi ridandant letez "c", "y" and "x" -- bai now jast a memori in the maindz ov ould doderez -- tu riplais "ch", "sh", and "th" rispektivli.
Fainali, xen, aafte sam 20 iers ov orxogrefkl riform, wi wud hev a lojikl, kohirnt speling in ius xrewawt xe Ingliy-spiking werld.
上面的内容为题目背景,跳过阅读这部分不妨碍解决本题。不过为了方便大家学习英语,我们将借鉴上述更容易拼读的方法重新修改英语单词,形式化地来说:
给定一个小写字母和空格的字符串。你需要对每个字符串按顺序执行下面 11 条规则,并输出最终结果。
空格的位置与数量必须原样保留,任何规则都不能跨过空格生效。
设当前处理的字符串为 S,规则如下:
ch 的 c。
c 的后一个字符是 e、i 或 y,则把它变成 s。k。x 变成 ks。wh 变成 w。g,如果它的后一个字符是 e、i 或 y,则把它变成 j;否则保持不变。y 变成 i。ee 变成 i。oo 变成 u。ch 变成 c。sh 变成 y。th 变成 x。其中,本题中的辅音指所有不属于 a、e、i、o、u 的小写字母。
注意:所有规则必须严格按照编号顺序执行。第 i+1 条规则看到的是第 i 条规则处理后的结果,而不是原字符串。
输入一行一个字符串 S(1≤∣S∣≤10000),保证每个字符串只包含小写字母和空格,且不存在行首空格、行尾空格、连续两个空格。
输出一行一个字符串,表示按题目要求完成全部操作后的结果。
which cheese
wic cise
第一组中,which 会先把 wh 变成 w,再把 ch 变成 c,得到 wic。cheese 会先保留开头的 ch,再把 ee 变成 i,最后再把 ch 变成 c,得到 cise。
giant bookkeeper thx xylophone shell book cool
jiant bukiper xks ksilophone yel buk kul
第二组中,空格位置始终保持不变;例如 shell 会先在第 8 条规则中把 ll 压成 l,再在第 10 条规则中把 sh 变成 y,得到 yel。
max golf xh kan eeee be beaten in one hundred bite
maks golf ky kan ii be beaten in one hundred bite
根据规则,对于某个单词,有可能会变化多次。
不保证数据中出现的单词在现实世界中存在。
whhh wh cycle
wh w sikle
whhh->whh->wh