r/badcode •

[deleted by user]

[deleted] — view deleted post

0 Upvotes

77 comments sorted by

View all comments

Show parent comment

2

u/VoilaLaViola Mar 03 '21

Just an idea to make your code messier, but making the logic bulletproof.

You need to assign a prime number to each letter. Easiest to use the first 26 prime numbers.

Then you can be 100% sure, when your text letters' assigned numbers give you the expected result of the first 26 primes multiplied, then your text passes. No false positives any more.