Created
August 24, 2023 12:58
-
-
Save ydm/75f8acbc51ca953a2c9bf77700302d3c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #include <stdio.h> | |
| int find_index(char s[], char element) | |
| { | |
| int i; | |
| for (i = 0; s[i] != '\0'; i++) | |
| { | |
| if (s[i] == element) | |
| { | |
| return i; | |
| } | |
| } | |
| return -1; | |
| } | |
| int main() | |
| { | |
| char c; | |
| char plain[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "; | |
| char cipher[] = "fAOjrhNKknMpIivUGmPxlQDeCTFJyt RLSWsdEXcYoawqZzbBugVH"; | |
| while ((c = getchar()) != EOF) | |
| { | |
| int i = find_index(cipher, c); | |
| if (i >= 0) | |
| { | |
| putchar(plain[i]); | |
| } | |
| else | |
| { | |
| putchar(c); | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment