Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = input()
- cnt = 0
- good = False
- for i in range(len(s)):
- if ('a' <= s[i] <= 'z' or 'A' <= s[i] <= 'Z' or (i - 1 >= 0 and i + 1 < len(s)
- and s[i] == '-' and ('a' <= s[i - 1] <= 'z' or 'A' <= s[i - 1] <= 'Z')
- and ('a' <= s[i + 1] <= 'z' or 'A' <= s[i + 1]))):
- good = True
- continue
- else:
- if (good):
- cnt += 1
- good = False
- if ('a'<= s[-1] <= 'z' or 'A' <= s[-1] <= 'Z'):
- cnt += 1
- print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement