-
-
Save papinianus/7586332fb4623035d969b4760140f4a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$strs = str_split(trim(fgets(STDIN))); | |
$alpha = 'ZABCDEFGHIJKLMNOPQRSTUVWXY'; //アルファベットを数値化するためのベース。文字のコード値が分からなかったので。 | |
foreach($strs as $i => $char) { //i番目の文字について | |
$coded = strpos($alpha, $char); // 暗号化された文字を数値化。 | |
$decod = (26+$coded-($i%26)-1)%26; // 暗号文字のから文字の場所をひく。マイナスにならないように26を足し、iも26の剰余にする | |
echo $alpha[$decod]; | |
} | |
echo PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment