Skip to main content
added 47 characters in body
Source Link
rayryeng
  • 1.6k
  • 1
  • 15
  • 20
  1. a = input('','s');: Gets a string from STDIN and stores it into the variable a.
  2. m=ismember(a,'aeiouy');: Returns a Boolean array that is the same size as the string a determining where vowels are located
  3. s='pgt vkh jglmn bqrzd fwx s'; The covfefe mapping of consonants as a string. This string is 25 characters long and omitting the vowels. The first position where the vowel a'a' is supposed to be is removed while the other positions where the vowels are located are placed with a dummy space character. This is so that when we determine the first consonant appearing after the vowel, we will convert the consonant to a position to access a character in this string to determine the first component of the converted word.
  4. m(1:find(m,1))=1: Sets the first position of the Boolean array up to where we have found the first vowel as all vowels. This will be so that when we search for the next consonant that follows the first vowel, we will ignore these characters.
  5. i=find(~m,1);: Finds the first position of the string that is a consonant after the first vowel.
  6. f=a(1:i): Removes the string after the first consonant that follows the vowel. We simply sample from the first position of the string up to this point.
  7. d=s(f(end)-97);: Take the last character of the string that is remaining and finds where we need to sample from the lookup string and gets that character. Subtracting a character and a number in MATLAB or Octave coalesces to form an integer by converting the character into its ASCII code. In this case, we subtract the last character by the character at the beginning of the alphabet to give us the position relative to the beginning. However, instead of subtracting by b (98), we subtract by a as MATLAB starts indexing by 1 instead of 0. 'a''s ASCII code is 97.
  8. m(1:i)=0;: Takes the Boolean mask and sets all characters in the input string from the first position to the first consonant following a vowel to false.
  9. v=a(find(m,1));: Finds the next vowel that follows the first consonant from the input string.
  10. [f d v d v]: Output our covfefeied string.
  1. a = input('','s');: Gets a string from STDIN.
  2. m=ismember(a,'aeiouy');: Returns a Boolean array that is the same size as the string a determining where vowels are located
  3. s='pgt vkh jglmn bqrzd fwx s'; The covfefe mapping of consonants as a string. This string is 25 characters long and omitting the vowels. The first position where a is supposed to be is removed while the other positions where the vowels are located are placed with a dummy space character. This is so that when we determine the first consonant appearing after the vowel, we will convert the consonant to a position to access a character in this string to determine the first component of the converted word.
  4. m(1:find(m,1))=1: Sets the first position of the Boolean array up to where we have found the first vowel as all vowels. This will be so that when we search for the next consonant that follows the first vowel, we will ignore these characters.
  5. i=find(~m,1);: Finds the first position of the string that is a consonant after the first vowel.
  6. f=a(1:i): Removes the string after the first consonant that follows the vowel. We simply sample from the first position of the string up to this point.
  7. d=s(f(end)-97);: Take the last character of the string that is remaining and finds where we need to sample from the lookup string and gets that character. Subtracting a character and a number in MATLAB or Octave coalesces to form an integer by converting the character into its ASCII code. In this case, we subtract the last character by the character at the beginning of the alphabet to give us the position relative to the beginning. However, instead of subtracting by b (98), we subtract by a as MATLAB starts indexing by 1 instead of 0. 'a''s ASCII code is 97.
  8. m(1:i)=0;: Takes the Boolean mask and sets all characters in the input string from the first position to the first consonant following a vowel to false.
  9. v=a(find(m,1));: Finds the next vowel that follows the first consonant from the input string.
  10. [f d v d v]: Output our covfefeied string.
  1. a = input('','s');: Gets a string from STDIN and stores it into the variable a.
  2. m=ismember(a,'aeiouy');: Returns a Boolean array that is the same size as the string a determining where vowels are located
  3. s='pgt vkh jglmn bqrzd fwx s'; The covfefe mapping of consonants as a string. This string is 25 characters long and omitting the vowels. The first position where the vowel 'a' is supposed to be is removed while the other positions where the vowels are located are placed with a dummy space character. This is so that when we determine the first consonant appearing after the vowel, we will convert the consonant to a position to access a character in this string to determine the first component of the converted word.
  4. m(1:find(m,1))=1: Sets the first position of the Boolean array up to where we have found the first vowel as all vowels. This will be so that when we search for the next consonant that follows the first vowel, we will ignore these characters.
  5. i=find(~m,1);: Finds the first position of the string that is a consonant after the first vowel.
  6. f=a(1:i): Removes the string after the first consonant that follows the vowel. We simply sample from the first position of the string up to this point.
  7. d=s(f(end)-97);: Take the last character of the string that is remaining and finds where we need to sample from the lookup string and gets that character. Subtracting a character and a number in MATLAB or Octave coalesces to form an integer by converting the character into its ASCII code. In this case, we subtract the last character by the character at the beginning of the alphabet to give us the position relative to the beginning. However, instead of subtracting by b (98), we subtract by a as MATLAB starts indexing by 1 instead of 0. 'a''s ASCII code is 97.
  8. m(1:i)=0;: Takes the Boolean mask and sets all characters in the input string from the first position to the first consonant following a vowel to false.
  9. v=a(find(m,1));: Finds the next vowel that follows the first consonant from the input string.
  10. [f d v d v]: Output our covfefeied string.
added 267 characters in body
Source Link
rayryeng
  • 1.6k
  • 1
  • 15
  • 20

MATLAB / Octave - 159159 158 bytes

a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a'97);m(1:i)=0;v=a(find(m,1));[f d v d v]
  1. a = input('','s');: Gets a string from STDIN.
  2. m=ismember(a,'aeiouy');: Returns a Boolean array that is the same size as the string a determining where vowels are located
  3. s='pgt vkh jglmn bqrzd fwx s'; The covfefe mapping of consonants as a string. This string is 25 characters long and omitting the vowels. The first position where a is supposed to be is removed while the other positions where the vowels are located are placed with a dummy space character. This is so that when we determine the first consonant appearing after the vowel, we will convert the consonant to a position to access a character in this string to determine the first component of the converted word.
  4. m(1:find(m,1))=1: Sets the first position of the Boolean array up to where we have found the first vowel as all vowels. This will be so that when we search for the next consonant that follows the first vowel, we will ignore these characters.
  5. i=find(~m,1);: Finds the first position of the string that is a consonant after the first vowel.
  6. f=a(1:i): Removes the string after the first consonant that follows the vowel. We simply sample from the first position of the string up to this point.
  7. d=s(f(end)-'a'97);: Take the last character of the string that is remaining and finds where we need to sample from the lookup string and gets that character. Subtracting two charactersa character and a number in MATLAB or Octave coalesces to form an integer by converting the character into its ASCII code. In this case, we subtract the last character by the character at the beginning of the alphabet to give us the position relative to the beginning. However, instead instead of subtracting by b (98), we subtract by a as MATLAB starts indexing by 1 instead of 0. 'a''s ASCII code is 97.
  8. m(1:i)=0;: Takes the Boolean mask and sets all characters in the input string from the first position to the first consonant following a vowel to false.
  9. v=a(find(m,1));: Finds the next vowel that follows the first consonant from the input string.
  10. [f d v d v]: Output our covfefeied string.
>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a'97);m(1:i)=0;v=a(find(m,1));[f d v d v]
coverage

ans =

covfefe

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a'97);m(1:i)=0;v=a(find(m,1));[f d v d v]
example

ans =

exxaxa

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a'97);m(1:i)=0;v=a(find(m,1));[f d v d v]
programming

ans =

progkaka

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a'97);m(1:i)=0;v=a(find(m,1));[f d v d v]
code

ans =

codtete

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a'97);m(1:i)=0;v=a(find(m,1));[f d v d v]
president

ans =

preszizi

http://www.tutorialspoint.com/execute_octave_online.php?PID=0Bw_CjBb95KQMNTc1ZnBiZ2d1S1Uhttp://www.tutorialspoint.com/execute_octave_online.php?PID=0Bw_CjBb95KQMdjROYVR0aFNrWXM

When you hit the Execute button at the top, wait a few moments, then enter the desired string. Enter the string slowly as there seems to be a delay when entering in text.

MATLAB / Octave - 159 bytes

a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a');m(1:i)=0;v=a(find(m,1));[f d v d v]
  1. a = input('','s');: Gets a string from STDIN.
  2. m=ismember(a,'aeiouy');: Returns a Boolean array that is the same size as the string a determining where vowels are located
  3. s='pgt vkh jglmn bqrzd fwx s'; The covfefe mapping of consonants as a string. This string is 25 characters long and omitting the vowels. The first position where a is supposed to be is removed while the other positions where the vowels are located are placed with a dummy space character. This is so that when we determine the first consonant appearing after the vowel, we will convert the consonant to a position to access a character in this string to determine the first component of the converted word.
  4. m(1:find(m,1))=1: Sets the first position of the Boolean array up to where we have found the first vowel as all vowels. This will be so that when we search for the next consonant that follows the first vowel, we will ignore these characters.
  5. i=find(~m,1);: Finds the first position of the string that is a consonant after the first vowel.
  6. f=a(1:i): Removes the string after the first consonant that follows the vowel. We simply sample from the first position of the string up to this point.
  7. d=s(f(end)-'a');: Take the last character of the string that is remaining and finds where we need to sample from the lookup string and gets that character. Subtracting two characters in MATLAB or Octave coalesces to form an integer. In this case, we subtract the last character by the character at the beginning of the alphabet to give us the position relative to the beginning. However, instead of subtracting by b, we subtract by a as MATLAB starts indexing by 1 instead of 0.
  8. m(1:i)=0;: Takes the Boolean mask and sets all characters in the input string from the first position to the first consonant following a vowel to false.
  9. v=a(find(m,1));: Finds the next vowel that follows the first consonant from the input string.
  10. [f d v d v]: Output our covfefeied string.
>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a');m(1:i)=0;v=a(find(m,1));[f d v d v]
coverage

ans =

covfefe

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a');m(1:i)=0;v=a(find(m,1));[f d v d v]
example

ans =

exxaxa

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a');m(1:i)=0;v=a(find(m,1));[f d v d v]
programming

ans =

progkaka

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a');m(1:i)=0;v=a(find(m,1));[f d v d v]
code

ans =

codtete

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-'a');m(1:i)=0;v=a(find(m,1));[f d v d v]
president

ans =

preszizi

http://www.tutorialspoint.com/execute_octave_online.php?PID=0Bw_CjBb95KQMNTc1ZnBiZ2d1S1U

MATLAB / Octave - 159 158 bytes

a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-97);m(1:i)=0;v=a(find(m,1));[f d v d v]
  1. a = input('','s');: Gets a string from STDIN.
  2. m=ismember(a,'aeiouy');: Returns a Boolean array that is the same size as the string a determining where vowels are located
  3. s='pgt vkh jglmn bqrzd fwx s'; The covfefe mapping of consonants as a string. This string is 25 characters long and omitting the vowels. The first position where a is supposed to be is removed while the other positions where the vowels are located are placed with a dummy space character. This is so that when we determine the first consonant appearing after the vowel, we will convert the consonant to a position to access a character in this string to determine the first component of the converted word.
  4. m(1:find(m,1))=1: Sets the first position of the Boolean array up to where we have found the first vowel as all vowels. This will be so that when we search for the next consonant that follows the first vowel, we will ignore these characters.
  5. i=find(~m,1);: Finds the first position of the string that is a consonant after the first vowel.
  6. f=a(1:i): Removes the string after the first consonant that follows the vowel. We simply sample from the first position of the string up to this point.
  7. d=s(f(end)-97);: Take the last character of the string that is remaining and finds where we need to sample from the lookup string and gets that character. Subtracting a character and a number in MATLAB or Octave coalesces to form an integer by converting the character into its ASCII code. In this case, we subtract the last character by the character at the beginning of the alphabet to give us the position relative to the beginning. However, instead of subtracting by b (98), we subtract by a as MATLAB starts indexing by 1 instead of 0. 'a''s ASCII code is 97.
  8. m(1:i)=0;: Takes the Boolean mask and sets all characters in the input string from the first position to the first consonant following a vowel to false.
  9. v=a(find(m,1));: Finds the next vowel that follows the first consonant from the input string.
  10. [f d v d v]: Output our covfefeied string.
>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-97);m(1:i)=0;v=a(find(m,1));[f d v d v]
coverage

ans =

covfefe

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-97);m(1:i)=0;v=a(find(m,1));[f d v d v]
example

ans =

exxaxa

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-97);m(1:i)=0;v=a(find(m,1));[f d v d v]
programming

ans =

progkaka

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-97);m(1:i)=0;v=a(find(m,1));[f d v d v]
code

ans =

codtete

>> a=input('','s');m=ismember(a,'aeiouy');s='pgt vkh jglmn bqrzd fwx s';m(1:find(m,1))=1;i=find(~m,1);f=a(1:i);d=s(f(end)-97);m(1:i)=0;v=a(find(m,1));[f d v d v]
president

ans =

preszizi

http://www.tutorialspoint.com/execute_octave_online.php?PID=0Bw_CjBb95KQMdjROYVR0aFNrWXM

When you hit the Execute button at the top, wait a few moments, then enter the desired string. Enter the string slowly as there seems to be a delay when entering in text.

added 79 characters in body
Source Link
rayryeng
  • 1.6k
  • 1
  • 15
  • 20
  1. a = input('','s');: Gets a string from STDIN.
  2. m=ismember(a,'aeiouy');: Returns a Boolean array that is the same size as the string a determining where vowels are located
  3. s='pgt vkh jglmn bqrzd fwx s'; The covfefe mapping of consonants as a string. This string is 25 characters long and omitting the vowels. The first position where a is supposed to be is removed while the other positions where the vowels are located are placed with a dummy space character. This is so that when we determine the first consonant appearing after the vowel, we will convert the consonant to a position to access a character in this string to determine the first component of the converted word.
  4. m(1:find(m,1))=1: Sets the first position of the Boolean array up to where we have found the first vowel as all vowels. This will be so that when we search for the next consonant that follows the first vowel, we will ignore these characters.
  5. i=find(~m,1);: Finds the first position of the string that is a consonant after the first vowel.
  6. f=a(1:i): Removes the string after the first consonant that follows the vowel. We simply sample from the first position of the string up to this point.
  7. d=s(f(end)-'a');: FindsTake the last character of the string that is remaining and finds where we need to sample from the lookup string and gets that character. Subtracting two characters in MATLAB or Octave coalesces to form an integer. In this case, we subtract the last character by the character at the beginning of the alphabet to give us the position relative to the beginning. However, instead of subtracting by b, we subtract by a as MATLAB starts indexing by 1 instead of 0.
  8. m(1:i)=0;: Takes the Boolean mask and sets all characters in the input string from the first position to the first consonant following a vowel to false.
  9. v=a(find(m,1));: Finds the next vowel that follows the first consonant from the input string.
  10. [f d v d v]: Output our covfefeied string.
  1. a = input('','s');: Gets a string from STDIN.
  2. m=ismember(a,'aeiouy');: Returns a Boolean array that is the same size as the string a determining where vowels are located
  3. s='pgt vkh jglmn bqrzd fwx s'; The covfefe mapping of consonants as a string. This string is 25 characters long and omitting the vowels. The first position where a is supposed to be is removed while the other positions where the vowels are located are placed with a dummy space character. This is so that when we determine the first consonant appearing after the vowel, we will convert the consonant to a position to access a character in this string to determine the first component of the converted word.
  4. m(1:find(m,1))=1: Sets the first position of the Boolean array up to where we have found the first vowel as all vowels. This will be so that when we search for the next consonant that follows the first vowel, we will ignore these characters.
  5. i=find(~m,1);: Finds the first position of the string that is a consonant after the first vowel.
  6. f=a(1:i): Removes the string after the first consonant that follows the vowel. We simply sample from the first position of the string up to this point.
  7. d=s(f(end)-'a');: Finds where we need to sample from the lookup string and gets that character. Subtracting two characters in MATLAB or Octave coalesces to form an integer. In this case, we subtract by the character at the beginning of the alphabet to give us the position relative to the beginning. However, instead of subtracting by b, we subtract by a as MATLAB starts indexing by 1 instead of 0.
  8. m(1:i)=0;: Takes the Boolean mask and sets all characters in the input string from the first position to the first consonant following a vowel to false.
  9. v=a(find(m,1));: Finds the next vowel that follows the first consonant from the input string.
  10. [f d v d v]: Output our covfefeied string.
  1. a = input('','s');: Gets a string from STDIN.
  2. m=ismember(a,'aeiouy');: Returns a Boolean array that is the same size as the string a determining where vowels are located
  3. s='pgt vkh jglmn bqrzd fwx s'; The covfefe mapping of consonants as a string. This string is 25 characters long and omitting the vowels. The first position where a is supposed to be is removed while the other positions where the vowels are located are placed with a dummy space character. This is so that when we determine the first consonant appearing after the vowel, we will convert the consonant to a position to access a character in this string to determine the first component of the converted word.
  4. m(1:find(m,1))=1: Sets the first position of the Boolean array up to where we have found the first vowel as all vowels. This will be so that when we search for the next consonant that follows the first vowel, we will ignore these characters.
  5. i=find(~m,1);: Finds the first position of the string that is a consonant after the first vowel.
  6. f=a(1:i): Removes the string after the first consonant that follows the vowel. We simply sample from the first position of the string up to this point.
  7. d=s(f(end)-'a');: Take the last character of the string that is remaining and finds where we need to sample from the lookup string and gets that character. Subtracting two characters in MATLAB or Octave coalesces to form an integer. In this case, we subtract the last character by the character at the beginning of the alphabet to give us the position relative to the beginning. However, instead of subtracting by b, we subtract by a as MATLAB starts indexing by 1 instead of 0.
  8. m(1:i)=0;: Takes the Boolean mask and sets all characters in the input string from the first position to the first consonant following a vowel to false.
  9. v=a(find(m,1));: Finds the next vowel that follows the first consonant from the input string.
  10. [f d v d v]: Output our covfefeied string.
deleted 22 characters in body; added 68 characters in body
Source Link
rayryeng
  • 1.6k
  • 1
  • 15
  • 20
Loading
added 1 character in body; deleted 1 character in body; added 136 characters in body; added 2 characters in body; added 2 characters in body; deleted 1 character in body
Source Link
rayryeng
  • 1.6k
  • 1
  • 15
  • 20
Loading
Source Link
rayryeng
  • 1.6k
  • 1
  • 15
  • 20
Loading