def encrypt_rail_fence(message: str, key: int) -> str:
encrypted = ""
for k in range(key):
if k == key - 1:
jump = (key - 1) * 2
else:
jump = (key - (k + 1)) * 2
for i in range(k, len(message), jump):
encrypted += message[i]
return encrypted
message = "computer science"
key = 3
encrypted = encrypt_rail_fence(message, key)
print(encrypted)