# 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: introductory

Starter code:

def replace_dashes_as_one(s):
	

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

import re
def replace_dashes_as_one(s):
  return re.sub("-[- ]*-","-",s)

from re import sub

def replace_dashes_as_one(s):
    return sub("-[\s-]*-", '-', s)

import re

def replace_dashes_as_one(s):
    return re.sub(r'-(\s*-)+', '-', s)

import re

def replace_dashes_as_one(s):
    return re.sub('-[\s-]*-', '-', 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(r'- *-','-',s))if re.search(r'- *-',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

from re import sub
def replace_dashes_as_one(s):
    return sub("-( *-)+","-",s)

import re
def replace_dashes_as_one(s):
    return re.sub(r'-(\s*-)*','-',s)