The vowels are A, E, I, O, U, and Y. A "number" is any single digit. A "character" can be either a letter or a number. Two or more consecutive characters make a "string". The entire string of characters is the "sequence". Spaces in between characters may be ignored. The words "before", "after", and "between" should all be treated as having an implied "immediately" before them. "In a row" means "consecutively, with no other characters interrupting the string". "Third from the end" means "two positions before the last character in the sequence". Each sentence after the boldfaced phrase below is a "direction". Directions separated by a period should be performed in that order; directions separated by a semicolon should be treated as simultaneous commands upon the sequence. Not every direction may be relevant.


Put an O after every 0 and a 1 before every I. If the first consonant also appears elsewhere in the sequence, eliminate the second occurrence. If the middle four characters spell a word, move them to the end of the sequence and then reverse the rest; otherwise, remove any consonant not in a two-consonant string. Replace any character that appears between a vowel and a number with an A. Replace the final occurrence of any consonant that appears at least twice in the sequence, or any vowel that appears at least three times in the sequence, with a 6. At the end of each half of the sequence, insert the number equal to the number of numbers in that half. Change each E to a D. If there are two numbers in a row, put a 0 between them; if there are three or more vowels in a row, remove the first of them; if there are four or more consonants in a row, change the second of them to a P. Replace the first character with three 1s. Reverse the last string of five letters. For any "letter-number-letter" string, eliminate the two letters. Take the last two numbers in the sequence and move them to the beginning of the sequence, not changing their order. If the last character is a letter, put a T after it; if the last character is a number, put an 8 after it. If two As appear in a row, put a 3 after them. For the string of three numbers that appears between two letters, replace the letter after those three numbers with their sum. Move the seventh character to the second position from the end. If the sequence contains an N, remove the characters before and after it; otherwise, replace the first consonant with an N. Move the second-to-last consonant to the end of the sequence. Reverse the characters in positions four through eight. Move the first three-letter string after the second number. Reverse the characters in positions nine and ten and then move them before the last 0. Move the third 1 after the first 1. If there are two consecutive identical letters, move one of them into position five. Move the last string of two numbers after the first string of three numbers. Move the character that's fifth from the end into the fourth position; if that character is a number, subtract one from it. Reverse the characters that are fifth and sixth from the end. If there are four letters between two numbers, move the third and fourth of those letters in front of the final vowel; if there are four numbers between two letters, move the first and second of those numbers in front of the final consonant. If the sequence begins with a 1, remove all the numbers; otherwise, don't change a thing.