From 2afbc768fc17d5f440fdb336c7f0f5e47157a196 Mon Sep 17 00:00:00 2001
From: Bob Mottram Some ordinary text ʇsǝʇ ɐ sı sıɥʇ Some ordinary text this is a test
', '') + start_separator = '
' + separator = '
' + paragraphs = text.split(separator) + new_text = '' + for para in paragraphs: + replaced_chars = 0 - index = 0 - z_value = ord('z') - for test_ch in inverted_lower: - if test_ch in text: - text = text.replace(test_ch, chr(z_value - index)) - replaced_chars += 1 - index += 1 + index = 0 + z_value = ord('z') + for test_ch in inverted_lower: + if test_ch == '_': + index += 1 + continue + if test_ch in para: + para = para.replace(test_ch, chr(z_value - index)) + replaced_chars += 1 + index += 1 - index = 0 - z_value = ord('Z') - for test_ch in inverted_upper: - if test_ch in text: - text = text.replace(test_ch, chr(z_value - index)) - replaced_chars += 1 - index += 1 + index = 0 + z_value = ord('Z') + for test_ch in inverted_upper: + if test_ch == '_': + index += 1 + continue + if test_ch in para: + para = para.replace(test_ch, chr(z_value - index)) + replaced_chars += 1 + index += 1 - if replaced_chars > 2: - text = text[::-1] + if replaced_chars > 2: + para = para[::-1] + if para: + new_text += start_separator + para + if separator in text: + new_text += separator - return text + return new_text