首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不是韦斯·托米斯

不是韦斯·托米斯
EN

Code Golf用户
提问于 2018-04-23 14:56:16
回答 24查看 7.3K关注 0票数 43

我只是喜欢这个简单的密码,它是如此有趣的阅读不完全人类可读的字和填补空白.

代码语言:javascript
复制
Ot wes thi bist uf tomis, ot wes thi wurst uf tomis, 
ot wes thi egi uf wosdum, ot wes thi egi uf fuuloshniss, 
ot wes thi ipuch uf biloif, ot wes thi ipuch uf oncridaloty, 
ot wes thi siesun uf loght, ot wes thi siesun uf derkniss, 
ot wes thi sprong uf hupi, ot wes thi wontir uf dispeor, 
wi hed ivirythong bifuri as, wi hed nuthong bifuri as, 
wi wiri ell guong dorict tu hievin, wi wiri ell guong dorict thi uthir wey – 
on shurt, thi piroud wes su fer loki thi prisint piroud, 
thet sumi uf ots nuosoist eathurotois onsostid un ots biong riciovid, 
fur guud ur fur ivol, on thi sapirletovi digrii uf cumperosun unly.

规则非常简单:

  • 接受一些文本作为输入(ascii字符,大小写字母和标点符号)。
  • 对于每个元音,将其旋转到下一个元音,或返回到开始。
    • A => e
    • E => I
    • I => o
    • O => u
    • U => a

  • 大写元音保持大写,小写元音保持小写。
  • 在这些转换之后输出文本。
  • 不需要支持口音。
  • 所有其他字符应保持不变。
  • 试着以最小的字节数来完成它。
  • 任何你喜欢的旧语言。

测试用例

代码语言:javascript
复制
It was the best of times, it was the worst of times,
it was the age of wisdom, it was the age of foolishness,
it was the epoch of belief, it was the epoch of incredulity,
it was the season of light, it was the season of darkness,
it was the spring of hope, it was the winter of despair,
we had everything before us, we had nothing before us,
we were all going direct to heaven, we were all going direct the other way –
in short, the period was so far like the present period,
that some of its noisiest authorities insisted on its being received,
for good or for evil, in the superlative degree of comparison only.

退出:

代码语言:javascript
复制
Ot wes thi bist uf tomis, ot wes thi wurst uf tomis, 
ot wes thi egi uf wosdum, ot wes thi egi uf fuuloshniss, 
ot wes thi ipuch uf biloif, ot wes thi ipuch uf oncridaloty, 
ot wes thi siesun uf loght, ot wes thi siesun uf derkniss, 
ot wes thi sprong uf hupi, ot wes thi wontir uf dispeor, 
wi hed ivirythong bifuri as, wi hed nuthong bifuri as, 
wi wiri ell guong dorict tu hievin, wi wiri ell guong dorict thi uthir wey – 
on shurt, thi piroud wes su fer loki thi prisint piroud, 
thet sumi uf ots nuosoist eathurotois onsostid un ots biong riciovid, 
fur guud ur fur ivol, on thi sapirletovi digrii uf cumperosun unly.

在:

代码语言:javascript
复制
The quick brown fox jumps over the lazy dog.

退出:

代码语言:javascript
复制
Thi qaock bruwn fux jamps uvir thi lezy dug.

在:

代码语言:javascript
复制
Home is where the heart is.

退出:

代码语言:javascript
复制
Humi os whiri thi hiert os.

在:

代码语言:javascript
复制
Boaty McBoatface

退出:

代码语言:javascript
复制
Buety McBuetfeci

在:

代码语言:javascript
复制
AEIOUaeiou

退出:

代码语言:javascript
复制
EIOUAeioua

在:

代码语言:javascript
复制
Programming Puzzles And Code Golf

退出:

代码语言:javascript
复制
Prugremmong Pazzlis End Cudi Gulf
EN

回答 24

Code Golf用户

回答已采纳

发布于 2018-04-23 17:28:15

斯塔克斯,7 字节数

代码语言:javascript
复制
öΦΣòC└∞

运行并调试它

在网上试试!

解释(未包装)

代码语言:javascript
复制
Vv:tVV:t
Vv:t           #Push aeiou and ring translate it to input
    VV:t       #Push AEIOU and ring translate it to input

也许能省下更多,会继续努力。

票数 12
EN

Code Golf用户

发布于 2018-04-23 15:51:20

MS-SQL,51位字节

工作于SQL 2017或更高版本:

代码语言:javascript
复制
SELECT TRANSLATE(v,'AEIOUaeiou','EIOUAeioua')FROM t

新函数TRANSLATE执行单个字符替换,因此非常适合于这一挑战。

输入是通过具有varchar列v,根据我们的IO规则的现有表t输入的.

在这种情况下,必须使用区分大小写的排序规则创建表,方法是在区分大小写的服务器上运行,或者使用COLLATE关键字(不计入字符总数):

代码语言:javascript
复制
CREATE TABLE t(v varchar(max) COLLATE Latin1_General_CS_AS)

编辑:当在“结果到文本”窗口( 这是一个客户端设置,而不是我的程序中的错误。 )中返回结果时,SSMS可能会切断上面冗长的引号。

若要修复,请转到Tools > Options > Query Results > SQL Server > Results to Text并增加“每列显示的最大字符数”。

票数 22
EN

Code Golf用户

发布于 2018-04-23 15:33:05

Bash + coreutils,24

代码语言:javascript
复制
tr aeiouAEIOU eiouaEIOUA

在网上试试!

票数 15
EN
页面原文内容由Code Golf提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://codegolf.stackexchange.com/questions/163141

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档