# 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]` string `str`
 
 
 - `[output]` a string

Difficulty: EASY
Starter code: def replace_dashes_as_one(s):
	

Solutions:
import re

def replace_dashes_as_one(s):
	return re.sub('-[ -]+-|-+', '-', s)


replace_dashes_as_one = lambda s: __import__('re').sub('-( *-)+', '-', s)


import re
replace_dashes_as_one = lambda s: replace_dashes_as_one(re.sub('- *-', '-', s)) if re.search('- *-', s) else s


def replace_dashes_as_one(s):
	res = ''
	i = 0
	while i < len(s):
		if s[i] != '-':
			res += s[i]
			i += 1
		else:
			res += '-'
			j = i + 1
			while j < len(s) and (s[j] == ' ' or s[j] == '-'):
				j += 1
			i = j
			if i < len(s) and s[i] != '-' and (s[i - 1] == ' '):
				res += ' '
	return res + ' ' if s[-1] == ' ' else res