Skip to main content
added 4 characters in body
Source Link
Business Cat
  • 9.2k
  • 1
  • 17
  • 37

CJam, 59 58 5757 56 bytes

q_{"aeiouy":V&,_T|:T^}#)/()@sV&0=1$\+"cbdfkszgvtpg"_W%er__W>"cbdfkszgvtpg"_W%er@sV&0=+_

Try it online!Try it online!

q_                   e# Read the input and copy it.
{                    e# Find the index of the first char for which the following is true:
 "aeiouy":V          e#  Push "aeiouy" and store it in V.
 &,                  e#  Check if the current char is in the vowel string (0 or 1).
 _T|:T               e#  Copy the result and OR with T (T is initially 0), storing back in T.
 ^                   e#  XOR with the original result. This will be 1 for the first 
                     e#  consonant appearing after a vowel.
}#                   e# (end find)
)/                   e# Increment the index and split the string into chunks of that size.
(                    e# Pull out the first chunk.
)_W>                  e# Copy e#it Pulland outget the last character of(the thatconsonant).
"cbdfkszgvtpg"_W%er string (e# Transliterate the consonant) to voiced/voiceless alternative.
@s                   e# Bring all the other split chunks to the top and join them together.
V&0=                 e# First char of the set intersection of that and the vowels.
                     e# (i.e. the first vowel in the second half)
1$++                    e# Concatenate the new consonant and the vowel.
"cbdfkszgvtpg"_W%er  e# Transliterate the consonant to voiced/voiceless alternative.
_                    e# Duplicate the result of that.
                     e# Implicit output of stack contents.

CJam, 59 58 57 bytes

q_{"aeiouy":V&,_T|:T^}#)/()@sV&0=1$\+"cbdfkszgvtpg"_W%er_

Try it online!

q_                   e# Read the input and copy it.
{                    e# Find the index of the first char for which the following is true:
 "aeiouy":V          e#  Push "aeiouy" and store it in V.
 &,                  e#  Check if the current char is in the vowel string (0 or 1).
 _T|:T               e#  Copy the result and OR with T (T is initially 0), storing back in T.
 ^                   e#  XOR with the original result. This will be 1 for the first 
                     e#  consonant appearing after a vowel.
}#                   e# (end find)
)/                   e# Increment the index and split the string into chunks of that size.
(                    e# Pull out the first chunk.
)                    e# Pull out the last character of that string (the consonant).
@s                   e# Bring all the other split chunks to the top and join them together.
V&0=                 e# First char of the set intersection of that and the vowels.
                     e# (i.e. the first vowel in the second half)
1$+                  e# Concatenate the consonant and the vowel.
"cbdfkszgvtpg"_W%er  e# Transliterate the consonant to voiced/voiceless alternative.
_                    e# Duplicate the result of that.
                     e# Implicit output of stack contents.

CJam, 59 58 57 56 bytes

q_{"aeiouy":V&,_T|:T^}#)/(_W>"cbdfkszgvtpg"_W%er@sV&0=+_

Try it online!

q_                   e# Read the input and copy it.
{                    e# Find the index of the first char for which the following is true:
 "aeiouy":V          e#  Push "aeiouy" and store it in V.
 &,                  e#  Check if the current char is in the vowel string (0 or 1).
 _T|:T               e#  Copy the result and OR with T (T is initially 0), storing back in T.
 ^                   e#  XOR with the original result. This will be 1 for the first 
                     e#  consonant appearing after a vowel.
}#                   e# (end find)
)/                   e# Increment the index and split the string into chunks of that size.
(                    e# Pull out the first chunk.
_W>                  e# Copy it and get the last character (the consonant).
"cbdfkszgvtpg"_W%er  e# Transliterate the consonant to voiced/voiceless alternative.
@s                   e# Bring all the other split chunks to the top and join them together.
V&0=                 e# First char of the set intersection of that and the vowels.
                     e# (i.e. the first vowel in the second half)
+                    e# Concatenate the new consonant and the vowel.
_                    e# Duplicate the result of that.
                     e# Implicit output of stack contents.
added 158 characters in body
Source Link
Business Cat
  • 9.2k
  • 1
  • 17
  • 37

CJam, 59 5858 57 bytes

q_{"aeiouy":V&,_T|:T^}#_#)W$<@@>/(\V&0=+"cbdfkszgvtpg"_W%er_)@sV&0=1$\+"cbdfkszgvtpg"_W%er_

Try it online!Try it online!

q_                   e# Read the input and copy it.
{                    e# Find the index of the first char for which the following is true:
 "aeiouy":V          e#  Push "aeiouy" and store it in V.
 &,                  e#  Check if the current char is in the vowel string (0 or 1).
 _T|:T               e#  Copy the result and OR with T (T is initially 0), storing back in T.
 ^                   e#  XOR with the original result. This will be 1 for the first 
                     e#  consonant appearing after a vowel.
}#                   e# (end find)
_)W$<@@>/                   e# SliceIncrement the index and split the string beforeinto (index)+1chunks andof afterthat (index)size.
(                    e# Pull out the first characterchunk.
) from                   e# Pull out the secondlast halfcharacter of that string (athe consonant).
\V&0=@s                   e# Bring all the other split chunks to the top and join them together.
V&0=                 e# First char of the set intersection of the second halfthat and the vowels.
                     e# (i.e. the first vowel in the second half)
+  1$+                  e# Concatenate the consonant and the vowel.
"cbdfkszgvtpg"_W%er  e# Transliterate the consonantsconsonant to voiced/voiceless alternative.
_                    e# Duplicate the result of that.
                     e# Implicit output of stack contents.

CJam, 59 58 bytes

q_{"aeiouy":V&,_T|:T^}#_)W$<@@>(\V&0=+"cbdfkszgvtpg"_W%er_

Try it online!

q_                   e# Read the input and copy it.
{                    e# Find the index of the first char for which the following is true:
 "aeiouy":V          e#  Push "aeiouy" and store it in V.
 &,                  e#  Check if the current char is in the vowel string (0 or 1).
 _T|:T               e#  Copy the result and OR with T (T is initially 0), storing back in T.
 ^                   e#  XOR with the original result. This will be 1 for the first 
                     e#  consonant appearing after a vowel.
}#                   e# (end find)
_)W$<@@>             e# Slice the string before (index)+1 and after (index).
(                    e# Pull out the first character from the second half (a consonant).
\V&0=                e# First char of the set intersection of the second half and the vowels.
                     e# (i.e. the first vowel in the second half)
+                    e# Concatenate the consonant and vowel.
"cbdfkszgvtpg"_W%er  e# Transliterate the consonants to voiced/voiceless alternative.
_                    e# Duplicate the result of that.
                     e# Implicit output of stack contents.

CJam, 59 58 57 bytes

q_{"aeiouy":V&,_T|:T^}#)/()@sV&0=1$\+"cbdfkszgvtpg"_W%er_

Try it online!

q_                   e# Read the input and copy it.
{                    e# Find the index of the first char for which the following is true:
 "aeiouy":V          e#  Push "aeiouy" and store it in V.
 &,                  e#  Check if the current char is in the vowel string (0 or 1).
 _T|:T               e#  Copy the result and OR with T (T is initially 0), storing back in T.
 ^                   e#  XOR with the original result. This will be 1 for the first 
                     e#  consonant appearing after a vowel.
}#                   e# (end find)
)/                   e# Increment the index and split the string into chunks of that size.
(                    e# Pull out the first chunk.
)                    e# Pull out the last character of that string (the consonant).
@s                   e# Bring all the other split chunks to the top and join them together.
V&0=                 e# First char of the set intersection of that and the vowels.
                     e# (i.e. the first vowel in the second half)
1$+                  e# Concatenate the consonant and the vowel.
"cbdfkszgvtpg"_W%er  e# Transliterate the consonant to voiced/voiceless alternative.
_                    e# Duplicate the result of that.
                     e# Implicit output of stack contents.
added 8 characters in body
Source Link
Business Cat
  • 9.2k
  • 1
  • 17
  • 37

CJam, 5959 58 bytes

q_{"aeiouy":V#)g_T|V&,_T|:T^}#_)W$<@@>(\V&0=+"cbdfkszgvtpg"_W%er_

Try it online!Try it online!

Explanation

q_                   e# Read the input and copy it.
{                    e# Find the index of the first char for which the following is true:
 "aeiouy":V          e#  Push "aeiouy" and store it in V.
 #)g&,                  e#  Check if the current char is in the vowel string (0 or 1).
 _T|:T               e#  Copy the result and OR with T (T is initially 0), storing back in T.
 ^                   e#  XOR with the original result. This will be 1 for the first 
                     e#  consonant appearing after a vowel.
}#                   e# (end find)
_)W$<@@>             e# Slice the string before (index)+1 and after (index).
(                    e# Pull out the first character from the second half (a consonant).
\V&0=                e# First char of the set intersection of the second half and the vowels.
                     e# (i.e. the first vowel in the second half)
+                    e# Concatenate the consonant and vowel.
"cbdfkszgvtpg"_W%er  e# Transliterate the consonants to voiced/voiceless alternative.
_                    e# Duplicate the result of that.
                     e# Implicit output of stack contents.

CJam, 59 bytes

q_{"aeiouy":V#)g_T|:T^}#_)W$<@@>(\V&0=+"cbdfkszgvtpg"_W%er_

Try it online!

Explanation

q_                   e# Read the input and copy it.
{                    e# Find the index of the first char for which the following is true:
 "aeiouy":V          e#  Push "aeiouy" and store it in V.
 #)g                 e#  Check if the current char is in the vowel string (0 or 1).
 _T|:T               e#  Copy the result and OR with T (T is initially 0), storing back in T.
 ^                   e#  XOR with the original result. This will be 1 for the first 
                     e#  consonant appearing after a vowel.
}#                   e# (end find)
_)W$<@@>             e# Slice the string before (index)+1 and after (index).
(                    e# Pull out the first character from the second half (a consonant).
\V&0=                e# First char of the set intersection of the second half and the vowels.
                     e# (i.e. the first vowel in the second half)
+                    e# Concatenate the consonant and vowel.
"cbdfkszgvtpg"_W%er  e# Transliterate the consonants to voiced/voiceless alternative.
_                    e# Duplicate the result of that.
                     e# Implicit output of stack contents.

CJam, 59 58 bytes

q_{"aeiouy":V&,_T|:T^}#_)W$<@@>(\V&0=+"cbdfkszgvtpg"_W%er_

Try it online!

Explanation

q_                   e# Read the input and copy it.
{                    e# Find the index of the first char for which the following is true:
 "aeiouy":V          e#  Push "aeiouy" and store it in V.
 &,                  e#  Check if the current char is in the vowel string (0 or 1).
 _T|:T               e#  Copy the result and OR with T (T is initially 0), storing back in T.
 ^                   e#  XOR with the original result. This will be 1 for the first 
                     e#  consonant appearing after a vowel.
}#                   e# (end find)
_)W$<@@>             e# Slice the string before (index)+1 and after (index).
(                    e# Pull out the first character from the second half (a consonant).
\V&0=                e# First char of the set intersection of the second half and the vowels.
                     e# (i.e. the first vowel in the second half)
+                    e# Concatenate the consonant and vowel.
"cbdfkszgvtpg"_W%er  e# Transliterate the consonants to voiced/voiceless alternative.
_                    e# Duplicate the result of that.
                     e# Implicit output of stack contents.
Source Link
Business Cat
  • 9.2k
  • 1
  • 17
  • 37
Loading