Given a string S of '$'s and '.'s. '$' are planks on the bridge and '.'s are the broken sections of the bridge. You can jump up to only that much gap (number of '.') of the broken section which you have already jumped over previously otherwise it takes you 1 day to learn how to jump that far. You have to find how many days will you take to cross the bridge.
Example 1:
Input:
S = $$..$$...$.$
Output:
2
Explanation:
1 day is required to practice
for 2 dots.Then next time 3 
dots are encountered so 1 more
day to practice. Then since 1 
dot is there you can easily do
that because you have already 
mastered for 3 dots.
Example 2:
Input:
S = $$$$.$
Output:
1
Explanation:
Only one is required to learn
to jump 1 gap.
Your Task:
You don't need to read input or print anything. Your task is to complete the function findDays() which takes the string S as input parameters and returns the total number of days you would take to cross the bridge.
 
Expected Time Complexity: O(|S|)
Expected Space Complexity: O(|S|)
 
Constraints:
1 ≤ T ≤ 100
1 ≤ |S| ≤ 10^{4}
S will consist of only the characters '$' and '.'
The first and the last characters of S will be '$'

Difficulty: EASY
Tags: String algorithms

Data structures
Skill types: Data structures
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(|S|)

Starter code:
#User function Template for python3
class Solution:
    def findDays (self, S):
        # code here

Solutions:
class Solution:

	def findDays(self, S):
		arr = map(len, S.split('$'))
		count = 0
		last = 0
		for item in arr:
			if item > last:
				count += 1
				last = item
		return count


class Solution:

	def findDays(self, S):
		c = 0
		maxi = 0
		d = 0
		for i in range(len(S)):
			if S[i] == '.':
				c += 1
			else:
				if c > maxi:
					d += 1
					maxi = c
				c = 0
		return d


class Solution:

	def findDays(self, S):
		m = 0
		a = 0
		c = 0
		for i in range(len(S)):
			if S[i] == '.':
				a += 1
			if S[i] != '.':
				if a > m:
					c += 1
				m = max(m, a)
				a = 0
		return c


import re

class Solution:

	def findDays(self, S):
		l = 0
		c = 0
		k = re.findall('\\.+', S)
		for i in k:
			if len(i) > l:
				c = c + 1
				l = len(i)
		return c


class Solution:

	def findDays(self, S):
		max_val = 0
		days = 0
		count = 0
		flag = False
		for i in range(len(S)):
			if S[i] == '.':
				count += 1
			else:
				if count > max_val:
					days += 1
					max_val = count
				count = 0
		return days


class Solution:

	def findDays(self, S):
		ls = []
		count = 0
		for i in S:
			if i == '.':
				count += 1
			if i == '$':
				ls.append(count)
				count = 0
		day = 0
		learn = 0
		for i in ls:
			if i == 0:
				pass
			if i > learn:
				day += 1
				learn = i
		return day


class Solution:

	def findDays(self, S):
		days = 0
		numdot = 0
		jump = 0
		for ch in S:
			if ch == '.':
				jump += 1
			else:
				if jump > numdot:
					days += 1
				numdot = max(numdot, jump)
				jump = 0
		return days


class Solution:

	def findDays(self, S):
		max = 0
		days = 0
		count = 0
		l = []
		for i in S:
			if i == '.':
				count += 1
			else:
				l.append(count)
				count = 0
		for i in range(len(l)):
			if l[i] > max:
				max = l[i]
				days += 1
		return days


class Solution:

	def findDays(self, s):
		min_gap = 0
		day = 0
		c = 0
		j = 0
		n = len(s)
		while j < n:
			while j < n and s[j] == '.':
				c += 1
				j += 1
			if c > min_gap:
				min_gap = c
				day += 1
			c = 0
			j += 1
		return day


class Solution:

	def findDays(self, S):
		count = 0
		value = 0
		l = []
		flag = False
		for i in S:
			if i == '.':
				count += 1
				flag = True
			else:
				if len(l) == 0 and count > 0:
					l.append(count)
					value += 1
					flag = False
				for j in range(len(l)):
					if count > max(l):
						l.append(count)
						value += 1
						flag = False
					flag = False
			if flag == False:
				count = 0
		return value