Given a string S and two integers L and R. Print the characters in the range L to R of the string.
NOTE: Assume zero based indexing.
Example 1:
Input: 
S = "cdbkdub"
L = 0 , R = 5
Output: "cdbkdu" 
Explanation: Starting from index 0 ('c')
to index 5 ('u').
Example 2:
Input: 
S = "sdiblcsdbud"
L = 3 , R = 7
Output: "blcsd"
Explanation: Starting from index 3 ('b')
to index 7 ('d').
Your Task:  
You dont need to read input or print anything. Complete the function javaSub() which takes S, L, R as input parameter and returns the sting from the range L to R.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(|S|)
Constraints:
1<= |S| <=1000
1 <= L <= 800
1 <= R <= 900

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3
class Solution:
    def javaSub (ob, S, L, R):
        # code here 

Solutions:
class Solution:

	def javaSub(ob, S, L, R):
		return S[L:R + 1]


class Solution:

	def javaSub(ob, S, L, R):
		l1 = len(S)
		if R + 1 < l1:
			return S[L:R + 1]
		else:
			return S[L:]


class Solution:

	def javaSub(ob, S, L, R):
		string = ''
		for i in range(L, R + 1):
			string += S[i]
		return string


class Solution:

	def javaSub(ob, S, L, R):
		String = list(S)
		arr = []
		for i in range(L, R + 1):
			arr.append(String[i])
		return ''.join(arr)


class Solution:

	def javaSub(ob, S, L, R):
		ans = ''
		for i in range(0, len(S), 1):
			if i >= L and i <= R:
				ans += S[i]
		return ans


class Solution:

	def javaSub(ob, S, L, R):
		s = str(S)
		return s[L:R + 1]


class Solution:

	def javaSub(ob, S, L, R):
		s = ''
		for i in range(L, R + 1):
			s = s + S[i]
		return str(s)


class Solution:

	def javaSub(ob, S, L, R):
		s1 = ''
		for c in range(L, R + 1):
			s1 += S[c]
		return s1


class Solution:

	def javaSub(ob, s, l, r):
		return s[l:r + 1]


class Solution:

	def javaSub(ob, S, L, R):
		output = ''
		for i in range(L, R + 1):
			result = S[i]
			output += result
		return output


class Solution:

	def javaSub(ob, s, L, R):
		newstr = ''
		for st in range(L, R + 1):
			newstr += s[st]
		return newstr


class Solution:

	def javaSub(ob, S, L, R):
		a = ''
		for i in range(len(S)):
			if i >= L and i <= R:
				a += S[i]
		return a


class Solution:

	def javaSub(ob, S, L, R):
		n = ''
		for x in range(L, R + 1):
			n = n + S[x]
		return n


class Solution:

	def javaSub(ob, S, L, R):
		a = []
		for i in range(L, R + 1, 1):
			a.append(S[i])
		b = ''.join(a)
		return b


class Solution:

	def javaSub(ob, arr, l, r):
		return arr[l:r + 1]