派生自这,现在删除,发布。
给定一个字符串,如果它构成一个好的主教密码,则回答它(真/假或两个一致的值),这是在满足以下所有条件时:
[0-9]
)如果您的代码是一个很好的毕晓普密码,您将得到0字节的奖励。
警告:不要用主教的善良作为实际密码强度的衡量标准!
PPCG123GCPP
PPCG123PPCG
PPCG123gcpp
0123456789
Tr0ub4dor&3
PPCG123
(太短)
correct horse battery staple
(没有足够的数字)
PPCG121GCPP
(回文)
(太短而没有足够的数字)
abc121cba
(太短和回文)
aaaaaaaaaaaa
(回文和数字不足)
abc99cba
(一切都不对)
发布于 2019-02-13 13:39:32
gT@Iþg3@IÂÊP
g # Get the length of the (implicit) input
T@ # Check if this length >= 10
Iþ # Get the input and only leave the digits
g # Then get the length (amount of digits)
3@ # And check if the amount of digits >= 3
IÂ # Get the input and the input reversed
Ê # Check if they are not equal (so not a palindrome)
P # Check if all three above are truthy (and output implicitly)
发布于 2019-02-13 13:42:54
发布于 2019-02-13 13:54:40
s->s.length()>9&s.replaceAll("\\D","").length()>2&!s.contains(new StringBuffer(s).reverse())
s-> // Method with String parameter and boolean return-type
s.length()>9 // Check if the length of the input-String is more than 9
&s.replaceAll("\\D","") // AND: remove all non-digits from the input-String
.length()>2 // and check if the amount of digits is more than 2
&!s.contains(new StringBuffer(s).reverse())
// AND: check if the input-String does NOT have the reversed
// input-String as substring (and thus is not a palindrome)
https://codegolf.stackexchange.com/questions/179841
复制相似问题