+ 7

Challenge: String Accumulator

Given an input string, must output an "accumulated" string, like shown in examples: input string --> output string "abc" --> "A-Bb-Ccc" "ECxa" --> "E-Cc-Xxx-Aaaa" "XmkkucH" --> "X-Mm-Kkk-Kkkk-Uuuuu-Cccccc-Hhhhhhh" "SoloLearN" --> "S-Oo-Lll-Oooo-Lllll-Eeeeee-Aaaaaaa-Rrrrrrrr-Nnnnnnnnn" "QpYWffvYGGyaX" --> "Q-Pp-Yyy-Wwww-Fffff-Ffffff-Vvvvvvv-Yyyyyyyy-Ggggggggg-Gggggggggg-Yyyyyyyyyyy-Aaaaaaaaaaaa-Xxxxxxxxxxxxx" And so on.. Let the codes begin and... happy hacking!

5th Sep 2017, 7:26 AM
noobcøder
noobcøder - avatar
9 Respuestas
5th Sep 2017, 7:41 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
5th Sep 2017, 12:28 PM
m abrate
m abrate - avatar
5th Sep 2017, 10:20 PM
noobcøder
noobcøder - avatar
+ 5
A quick (though cramped) one-liner in Ruby: https://code.sololearn.com/c1oWp4whRm6s/?ref=app
5th Sep 2017, 8:52 AM
André
André - avatar
5th Sep 2017, 10:07 AM
sayan chandra
sayan chandra - avatar
+ 4
Here's my C# implementation ✌ LINQ One-Liner〰 string.Join("-", str.Select( (c, i) => c.ToString().ToUpper() + new string(Enumerable.Repeat(c, i).ToArray()) )) https://code.sololearn.com/c04sO2WFk9M2/?ref=app
5th Sep 2017, 9:36 AM
Zephyr Koo
Zephyr Koo - avatar
11th Sep 2017, 11:52 AM
ⵢⴷⵢⴷ
ⵢⴷⵢⴷ - avatar
+ 4
Here you go. Ignores whitespace. https://code.sololearn.com/cXbbu7L0jpCe/?ref=app
11th Sep 2017, 2:28 PM
Vari93
Vari93 - avatar