+ 54

(Challenge) Singlify Double Letters

Here's an easy one. Take an input string and replace all double letters with single letters. E.g. Happy Mississippi! => Hapy Misisipi! The only tricky bit may be the shrinking length as letters are removed.

26th Dec 2017, 4:17 AM
David Ashton
David Ashton - avatar
96 odpowiedzi
+ 7
Closed-source-like JavaScript approach. I created both this code itself and the method to convert normal JavaScript source code to closed-source-like JS. I have a private code to automatically convert any JS source code to closed-source-like JS very easily, but it sould be difficult for other people to reverse the process :) This could be beneficial for companies who want to sell their apps or if the security of an app depends on it being closed source https://code.sololearn.com/WBWYRMIVmv2S/?ref=app
27th Dec 2017, 10:32 PM
Augustinas Lukauskas
Augustinas Lukauskas - avatar
+ 44
https://code.sololearn.com/c8Rpw4gCF6hN/?ref=app
26th Dec 2017, 4:39 AM
qwerty
qwerty - avatar
+ 22
I... I made a little something. :> https://code.sololearn.com/cQ8971friVmg/?ref=app
26th Dec 2017, 7:22 AM
Hatsy Rei
Hatsy Rei - avatar
+ 20
https://code.sololearn.com/cmgkg7ysdogj/?ref=app
26th Dec 2017, 4:58 AM
Kodirbek Makharov
Kodirbek Makharov - avatar
26th Dec 2017, 4:25 AM
Louis
Louis - avatar
+ 19
26th Dec 2017, 2:29 PM
Justine Ogaraku
Justine Ogaraku - avatar
26th Dec 2017, 2:40 PM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 17
https://code.sololearn.com/cfmru654iTXS/?ref=app Simple and straightforward :)
26th Dec 2017, 7:49 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 17
My apologies for not clarifying whether code-created double letters need to be reduced further (I didn't think about it because real words don't have triple and quadruple letters), but 'lasssso' becomes 'lasso' and no problem if your code takes it further to 'laso'. Thanks for all the great efforts!
27th Dec 2017, 8:00 AM
David Ashton
David Ashton - avatar
26th Dec 2017, 10:34 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
+ 16
Congratulations Sir Ashton for Moderator Badge!! and for 100 codes!
26th Dec 2017, 2:21 PM
Abhishek Tandon
Abhishek Tandon - avatar
+ 16
I'm having an absolutely impossible time trying to choose a 'best answer' going through all these brilliant innovative clever creative demonstrations of thinking outside the box and learned a whole new bag of tricks in the process. But since it wouldn't be fair to just wander off without naming a winner, I'm going to choose Augustinas Lukauskas's simple but elegant JavaScript that actually works! https://code.sololearn.com/WBWYRMIVmv2S/?ref=app. (I would be pulling out my hair if I had any....) Congrats to everyone for a terrific job!
28th Dec 2017, 11:24 AM
David Ashton
David Ashton - avatar
27th Dec 2017, 12:41 AM
AZTECCO
AZTECCO - avatar
+ 15
Here's mine by the way. Not nearly as elegant as many of the really clever solutions here! https://code.sololearn.com/cGF8xWbsutl0/?ref=app
27th Dec 2017, 7:44 AM
David Ashton
David Ashton - avatar
27th Dec 2017, 4:44 AM
Vishal Pal❄️⚛️
Vishal Pal❄️⚛️ - avatar
+ 12
singlify=lambda c:c[0]+"".join(c[i] for i in range(1,len(c)) if c[i-1]!=c[i])
26th Dec 2017, 7:47 AM
VcC
VcC - avatar
26th Dec 2017, 8:14 AM
MrCoder
MrCoder - avatar
+ 12
Loved the challenge!! Here's mine in C https://code.sololearn.com/c2xKYMbanem6/?ref=app
26th Dec 2017, 2:12 PM
Abhishek Tandon
Abhishek Tandon - avatar
+ 12
This code deletes repeated characters: https://code.sololearn.com/c8l5bioH78i7/?ref=app
26th Dec 2017, 5:39 PM
Vahid Shirbisheh
Vahid Shirbisheh - avatar
+ 11
My try is in Java this time because many Python versions are here. Edit: I am adding Python. :) https://code.sololearn.com/c9Kiu73fUKWF/?ref=app https://code.sololearn.com/cUK7USFdGNv7/?ref=app
26th Dec 2017, 11:11 PM
Ferhat Sevim
Ferhat Sevim - avatar