Given a string S as input. Delete the characters at odd indices of the string.
Example 1:
Input: S = "Geeks"
Output: "Ges" 
Explanation: Deleted "e" at index 1
and "k" at index 3.
Example 2:
Input: S = "GeeksforGeeks"
Output: "GesoGes"
Explanation: Deleted e, k, f, r, e
k at index 1, 3, 5, 7, 9, 11.
Your Task:  
You dont need to read input or print anything. Complete the function delAlternate() which takes S as input parameter and returns the final string after deletion of characters at odd indices.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(|S|)
Constraints:
1<= |S| <=1000

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

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

Solutions:
class Solution:

	def delAlternate(ob, S):
		return S[::2]


class Solution:

	def delAlternate(ob, S):
		l = []
		s = list(S)
		for i in range(len(S)):
			if i % 2 == 1:
				l.append(i)
		l.reverse()
		for i in l:
			s.pop(i)
		return ''.join(s)


class Solution:

	def delAlternate(ob, S):
		res = []
		for i in range(len(S)):
			if i % 2 == 0:
				res.append(S[i])
		return ''.join(res)


class Solution:

	def delAlternate(ob, S):
		result = ''
		for i in range(len(S)):
			if i % 2 == 0:
				result += S[i]
		return result


class Solution:

	def delAlternate(ob, S):
		c = ''
		for i in S[0::2]:
			c += i
		return c


class Solution:

	def delAlternate(ob, S):
		res = ''
		for i in range(len(S)):
			i = int(i)
			if i % 2 == 0:
				res += S[i]
		return res


class Solution:

	def delAlternate(ob, S):
		l = ''
		for i in range(0, len(S), 2):
			l += S[i]
		return l


class Solution:

	def delAlternate(ob, S):
		i = 0
		res = ''
		for e in S:
			if i % 2 == 0:
				res = res + e
			i = i + 1
		return res


class Solution:

	def delAlternate(ob, S):
		return ''.join(map(str, [S[i] for i in range(0, len(S), 2)]))


class Solution:

	def delAlternate(ob, S):
		S = str(S)[0:len(S):2]
		return S


class Solution:

	def delAlternate(ob, S):
		k = []
		for i in range(len(S)):
			if i % 2 == 0:
				k += S[i]
		return ''.join(k)


class Solution:

	def delAlternate(ob, S):
		c = S[0::2]
		return c


class Solution:

	def delAlternate(ob, s):
		l = len(s)
		s1 = ''
		for i in range(l):
			if i % 2 == 0:
				s1 += s[i]
		return s1


class Solution:

	def delAlternate(ob, S):
		String = list(S)
		for i in range(len(String)):
			if i % 2 != 0:
				String[i] = ''
		return ''.join(String)


class Solution:

	def delAlternate(ob, S):
		s_str_list = list(S)
		i = 1
		while i < len(s_str_list):
			s_str_list.pop(i)
			i += 1
		return ''.join(s_str_list)


class Solution:

	def delAlternate(ob, S):
		l = ''
		for i in range(len(S)):
			if i % 2 == 0:
				l = l + S[i]
			else:
				continue
		return l


class Solution:

	def delAlternate(ob, S):
		newstr = ''
		i = 0
		while i < len(S):
			if i % 2 == 0:
				newstr += S[i]
			i += 1
		return newstr


class Solution:

	def delAlternate(ob, S):
		data = list(S)
		list1 = []
		for x in range(len(data)):
			if x % 2 == 0:
				list1.append(data[x])
		result = ','.join(list1)
		return result.replace(',', '')


class Solution:

	def delAlternate(ob, S):
		newstr = ''
		for i in range(len(S)):
			if i % 2 == 0:
				newstr = newstr + S[i]
			else:
				pass
		return newstr


class Solution:

	def delAlternate(ob, S):
		n = ''
		for (idx, each) in enumerate(S):
			if idx % 2 == 0:
				n += each
		return n


class Solution:

	def delAlternate(ob, S):
		ks = ''
		for i in range(len(S)):
			if i % 2 == 0:
				arr = S[i]
				ks += arr
		return ks


class Solution:

	def delAlternate(ob, S):
		str2 = ''
		for i in range(0, len(S), 1):
			if i % 2 == 0:
				str2 += S[i]
		return str2


class Solution:

	def delAlternate(ob, S):
		ans = ''
		n = len(S)
		for i in range(0, n, 2):
			ans += S[i]
		return ans


class Solution:

	def delAlternate(ob, S):
		l = list(S)
		ls = []
		for i in range(len(l)):
			if i % 2 == 0:
				ls.append(l[i])
		return ''.join(ls)


class Solution:

	def delAlternate(ob, s):
		n = ''
		for i in range(len(s)):
			if i % 2 == 0:
				n += s[i]
			else:
				continue
		return n


class Solution:

	def delAlternate(ob, S):
		new_str = ''
		i = 0
		while i < len(S):
			if i % 2 == 1:
				i += 1
				continue
			new_str += S[i]
			i += 1
		return new_str


class Solution:

	def delAlternate(ob, S):
		s1 = list()
		n = len(S)
		for i in range(n):
			if i % 2 == 0:
				s1.append(S[i])
		j = ''.join(s1)
		return j


class Solution:

	def delAlternate(ob, S):
		x = S[0::2]
		return x


class Solution:

	def delAlternate(ob, S):
		count = 0
		s1 = ''
		for i in range(len(S)):
			if i % 2 == 0:
				s1 = s1 + S[i]
		return s1


class Solution:

	def delAlternate(self, S):
		x = len(S)
		a = list(S)
		b = ''
		for i in range(1, x, 2):
			a[i] = ''
		for i in a:
			b += i
		return b


class Solution:

	def delAlternate(self, S):
		a = ''
		for i in range(1, len(S) + 1):
			if i % 2 == 1:
				a += S[i - 1]
		return a


class Solution:

	def delAlternate(ob, S):
		str = list(S)
		a = []
		for i in range(len(S)):
			if i % 2 == 0:
				a.append(str[i])
		k = ''.join(a)
		return k