#!/bin/python3

# Given an unsorted array of integers, 
# find the length of longest continuous increasing subsequence. 
import pdb
	
class Solution(object):
	def findLengthOfLCIS(self, a):
		"""
		:type c: int
		:rtype: int
		"""
		last_start = 0
		last_end   = 0
		last_count  = 0
		running_count = 1
		current_start = 0
		current_end  = 0
		#pdb.set_trace()
		if len(a)==0:
			return 0

		for i in range(1,len(a)):

			if a[i]>a[i-1]:
				running_count +=1
				current_end = i
				#print("running count:", running_count)
				if(running_count>last_count):
					
					last_count = running_count
					last_start = current_start
					last_end   = i		
			else:				
				current_start = i
				current_end = i
				running_count = 1 ## Note that it is reset to 1				
		
		print(last_start, last_end)

		return (last_end+1) - last_start								
		

def main():

	print ("longest continuous increasing subsequence")
	sol = Solution()
	
	a = [1,3,5,4,7,8,9,10,12]
	c = [1,3,5,4,7,8,9,10,12,9,5]
	b = [1,3,5,4,6,5]
	d = [2,2,2,2]
	f = [1]
	x = [1,3,5,4,2,3,4,5]

	result = sol.findLengthOfLCIS(x)

	print(result)

if __name__=="__main__":main()
