What's the wrong in this code?
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main() { char phrase[100]; fgets(phrase,100,stdin); // convert everything to lower case for(int i = 0; phrase[i]; i++) { phrase[i] = tolower(phrase[i]); } char ciphertext[100]; char *alphabet = "abcdefghijklmnopqrstuvwxyz"; char *alphakey = "zyxwvutsrqponmlkjihgfedcba"; for(int i = 0; i < (int) strlen(phrase); i++) { // just add to ciphertext if space if (*(phrase + i) == ' ') { ciphertext[i] = *(phrase + i); } else { for(int x = 0; x < (int) strlen(alphabet); x++) { if (*(phrase + i) == *(alphabet + x)) { // get letter from the same index in alphakey ciphertext[i] = *(alphakey + x); } } } } printf("%s\n", ciphertext); return 0; } https://www.sololearn.com/coach/66?ref=app