#!/usr/bin/env python3

# Reverse string
hey = "hey"
print("Original string: " + hey)
print("Reversed string: " + hey[::-1])

# Alternate order for string
example = input("Please input a long string: ")
for i in range(len(example)):
    if i % 2 == 0:
        print(example[i], end="")
    else:
        print(example[i].capitalize(), end="")
print()

# Caesar cipher
cipherText = ""
for ch in example:
    if ch.isalpha():
        shifted_character = ord(ch) + 17 
        
        if shifted_character > ord('z'):
            shifted_character -= 26
            
        finalLetter = chr(shifted_character)
        cipherText += finalLetter
print("Your ciphertext is: ", cipherText)

decryptedText = ""
for ch in cipherText:
    if ch.isalpha():
        shifted_character = ord(ch) - 17 
        
        if shifted_character < ord('a'):
            shifted_character += 26
            
        finalLetter = chr(shifted_character)
        decryptedText += finalLetter
    else:
        decryptedText += ch

print("Mesajul descifrat este: ", decryptedText)