Skip to main content
Commonmark migration
Source Link

#Python, 261 260 bytes

Python, 261 260 bytes

def c(s,t='bpcgdtfvgksz'):
 q,r,t='aeiouy',range(len(s)),t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2

A Non regex, Not esoteric solution. Took about 20 minutes to make, and an hour more to golf.

It probably has more list comprehension than the entire python standard library, mostly because I don't know regex...

Try it online! (With testcases)

#Python, 261 260 bytes

def c(s,t='bpcgdtfvgksz'):
 q,r,t='aeiouy',range(len(s)),t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2

A Non regex, Not esoteric solution. Took about 20 minutes to make, and an hour more to golf.

It probably has more list comprehension than the entire python standard library, mostly because I don't know regex...

Try it online! (With testcases)

Python, 261 260 bytes

def c(s,t='bpcgdtfvgksz'):
 q,r,t='aeiouy',range(len(s)),t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2

A Non regex, Not esoteric solution. Took about 20 minutes to make, and an hour more to golf.

It probably has more list comprehension than the entire python standard library, mostly because I don't know regex...

Try it online! (With testcases)

-1
Source Link
sagiksp
  • 1.4k
  • 12
  • 19

#Python, 261261 260 bytes

def c(s,t='bpcgdtfvgksz'):
 q,r,t='aeiouy',range(len(s)),'bpcgdtfvgksz'
 t=t+t[t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2

A Non regex, Not esoteric solution. Took about 20 minutes to make, and an hour more to golf.

It probably has more list comprehension than the entire python standard library, mostly because I don't know regex...

Try it online! (With testcases)

#Python, 261 bytes

def c(s):
 q,r,t='aeiouy',range(len(s)),'bpcgdtfvgksz'
 t=t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2

A Non regex, Not esoteric solution. Took about 20 minutes to make, and an hour more to golf.

It probably has more list comprehension than the entire python standard library, mostly because I don't know regex...

Try it online! (With testcases)

#Python, 261 260 bytes

def c(s,t='bpcgdtfvgksz'):
 q,r,t='aeiouy',range(len(s)),t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2

A Non regex, Not esoteric solution. Took about 20 minutes to make, and an hour more to golf.

It probably has more list comprehension than the entire python standard library, mostly because I don't know regex...

Try it online! (With testcases)

added 38 characters in body
Source Link
sagiksp
  • 1.4k
  • 12
  • 19

#Python, 261 bytes

def c(s):
 q,r,t='aeiouy',range(len(s)),'bpcgdtfvgksz'
 t=t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2
def c(s):
 q,r,t='aeiouy',range(len(s)),'bpcgdtfvgksz'
 t=t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2

A Non regex, Not esoteric solution. Took about 20 minutes to make, and an hour more to golf.

It probably has more list comprehension than the entire python standard library, mostly because I don't know regex...

Try it online! (With testcases)

#Python, 261 bytes

def c(s):
 q,r,t='aeiouy',range(len(s)),'bpcgdtfvgksz'
 t=t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2

A Non regex, Not esoteric solution. Took about 20 minutes to make, and an hour more to golf.

It probably has more list comprehension than the entire python standard library, mostly because I don't know regex...

Try it online! (With testcases)

#Python, 261 bytes

def c(s):
 q,r,t='aeiouy',range(len(s)),'bpcgdtfvgksz'
 t=t+t[::-1]
 c=[i for i in r if i>[j for j in r if s[j]in q][0]and s[i]not in q][0]
 C=([t[2*i+1]for i in range(12)if s[c]==t[i*2]]or s[c])[0]
 return s[:c+1]+(C+s[[i for i in r if i>c and s[i]in q][0]])*2

A Non regex, Not esoteric solution. Took about 20 minutes to make, and an hour more to golf.

It probably has more list comprehension than the entire python standard library, mostly because I don't know regex...

Try it online! (With testcases)

Source Link
sagiksp
  • 1.4k
  • 12
  • 19
Loading