6 kyu
Simple Fun #161: Replace Dashes As One
217 of 491myjinxin2015
Description:
Task
If string has more than one neighboring dashes(e.g. --) replace they with one dash(-).
Dashes are considered neighbors even if there is some whitespace between them.
Example
For str = "we-are- - - code----warriors.-"
The result should be "we-are- code-warriors.-"
Input/Output
[input]
stringstr
[output]
a string
Algorithms
Similar Kata:
Stats:
Created | Feb 24, 2017 |
Published | Feb 24, 2017 |
Warriors Trained | 1101 |
Total Skips | 19 |
Total Code Submissions | 2868 |
Total Times Completed | 491 |
JavaScript Completions | 216 |
C# Completions | 55 |
Python Completions | 217 |
Ruby Completions | 43 |
Total Stars | 19 |
% of votes with a positive feedback rating | 94% of 158 |
Total "Very Satisfied" Votes | 141 |
Total "Somewhat Satisfied" Votes | 16 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 10 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 7 kyu |