Caesar Cipher decryption using frequency analysis
$ swiftc main.swift -o decipher
$ ./decipher
Usage: decipher <text>
Ex.:
$ ./decipher "RD QTAJ KTW YMJ WTRFS JRUNWJ NX ZSIJSNFGQD LWJFYJW YMFS KTW RDXJQK. YMJ LWJFYJXY JRUNWJ JAJW YT MFAJ JCNXYJI. N UQJILJ RD JYJWSFQ XJWANYZIJ FSI N FR KTWJAJW GTZSI YT XJWAJ NY, NS QNKJ FSI NS IJFYM. YMJD MFAJ RJWJQD LNAJS ZX: WTFIX, HJSYWFQ MJFYNSL, HTSHWJYJ, YMJ HFQJSIFW, FSI KQZXMNSL YTNQJYX FSI XJBJWX."
With a probability of 8.81%, the decrypted text is:
MY LOVE FOR THE ROMAN EMPIRE IS UNDENIABLY GREATER THAN FOR MYSELF. THE GREATEST EMPIRE EVER TO HAVE EXISTED. I PLEDGE MY ETERNAL SERVITUDE AND I AM FOREVER BOUND TO SERVE IT, IN LIFE AND IN DEATH. THEY HAVE MERELY GIVEN US: ROADS, CENTRAL HEATING, CONCRETE, THE CALENDAR, AND FLUSHING TOILETS AND SEWERS.