Given a string S, the task is to create a string with the first letter of every word in the string.
 
Example 1:
Input: 
S = "geeks for geeks"
Output: gfg
Example 2:
Input: 
S = "bad is good"
Output: big
Your Task:
You don't need to read input or print anything. Your task is to complete the function firstAlphabet() which takes string S as input parameter and returns a string that contains the first letter of every word in S.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(|S|)
Constraints:
1 <= |S| <= 10^{5}
S contains lower case English alphabets
Words have a single space between them.

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

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

Solutions:
class Solution:

	def firstAlphabet(self, S):
		S = list(S.split(' '))
		temp = ''
		for i in range(len(S)):
			temp += S[i][0]
		return temp


class Solution:

	def firstAlphabet(self, S):
		a = S.split()
		b = ''
		for word in a:
			b += str(word[0])
		return b


class Solution:

	def firstAlphabet(self, S):
		a = S.split()
		n = ''
		for i in a:
			n += i[:1]
		return n


class Solution:

	def firstAlphabet(self, S):
		d = ''
		first_letters = [word[0] for word in S.split()]
		for i in first_letters:
			if i == ' ':
				continue
			else:
				d += i
		return d


class Solution:

	def firstAlphabet(self, S):
		x = S.split()
		res = [item[0] for item in x]
		return ''.join(res)


class Solution:

	def firstAlphabet(self, S):
		ans = S[0]
		for i in range(len(S)):
			if S[i] == ' ':
				ans = ans + S[i + 1]
		return ans


class Solution:

	def firstAlphabet(self, S):
		str1 = ''
		for i in range(len(S)):
			if i == 0:
				str1 = str1 + S[i]
			elif ' ' in S[i]:
				str1 = str1 + S[i + 1]
			else:
				continue
		return str1


class Solution:

	def firstAlphabet(self, s):
		ans = ''
		x = s.split(' ')
		for i in range(len(x)):
			ans += x[i][0]
		return ans


class Solution:

	def firstAlphabet(self, S):
		arr = [i for i in S.split(' ')]
		s = ''
		for i in arr:
			s += i[0]
		return s


class Solution:

	def firstAlphabet(self, S):
		l = len(S)
		print(S[0], end='')
		for i in range(l):
			if S[i] == ' ':
				print(S[i + 1], end='')
		return ''


class Solution:

	def firstAlphabet(self, S):
		words = S.split()
		lst = []
		for i in words:
			lst.append(i[0])
		res = ''.join(map(str, lst))
		return res


class Solution:

	def firstAlphabet(self, S):
		string = ''
		for i in S.split():
			string += i[0]
		return string


class Solution:

	def firstAlphabet(self, S):
		ans = ''
		X = S.split(' ')
		for i in range(len(X)):
			ans += X[i][0]
		return ans


class Solution:

	def firstAlphabet(self, S):
		l = []
		S = S.split(' ')
		for i in range(len(S)):
			l.append(S[i][0])
		str = ''
		for i in l:
			str += i
		return str


class Solution:

	def firstAlphabet(self, S):
		L = S.split(' ')
		em = ''
		for i in L:
			em += i[0]
		return em


class Solution:

	def firstAlphabet(self, S):
		l = S.split()
		first = ''
		for i in l:
			first += i[0]
		return first


class Solution:

	def firstAlphabet(self, S):
		res = S.split()
		result = ''
		for i in res:
			result += i[0]
		return result


class Solution:

	@staticmethod
	def firstAlphabet(S):
		result = []
		S = S.split(' ')
		for i in S:
			result.append(i[0])
			join = ''.join(result)
		return join


class Solution:

	def firstAlphabet(self, S):
		a = []
		a.append(S[0])
		for i in range(1, len(S) - 1):
			if S[i] == ' ' and S[i + 1] != ' ':
				a.append(S[i + 1])
		g = str(''.join(map(str, a)))
		return g


class Solution:

	def firstAlphabet(self, S):
		res = next(zip(*S.split()))
		return ''.join(res)


class Solution:

	def firstAlphabet(self, S):
		temp = S.split()
		x = ''
		for i in temp:
			x = x + i[0]
		return x


class Solution:

	def firstAlphabet(self, S):
		l1 = []
		num = S.split(' ')
		for i in num:
			l1.append(i[0])
		return ''.join(l1)


class Solution:

	def firstAlphabet(self, S):
		s = S.split()
		a = []
		for i in s:
			a.append(i[0])
		return ''.join(a)


class Solution:

	def firstAlphabet(self, S):
		l = list(S.split(' '))
		stri = ''
		for i in l:
			stri += i[:1]
		return stri


class Solution:

	def firstAlphabet(self, S):
		ans = S.split()
		res = ''
		for word in ans:
			res += word[0]
		return res


class Solution:

	def firstAlphabet(self, S):
		l = S.split(' ')
		k = []
		for i in l:
			k.append(i[0])
		return ''.join(k)


class Solution:

	def firstAlphabet(self, s):
		s = s.split()
		t = ''
		for i in s:
			t += i[0]
		return t


class Solution:

	def firstAlphabet(self, S):
		str = ''
		w = S.split(' ')
		for x in w:
			str = str + x[0]
		return str


class Solution:

	def firstAlphabet(self, S):
		a = S.split()
		s = ''
		for I in a:
			s += I[0]
		return s


class Solution:

	def firstAlphabet(self, S):
		S = ' ' + S
		res = ''
		for i in range(len(S)):
			if S[i] == ' ':
				res += S[i + 1]
		return res


class Solution:

	def firstAlphabet(self, S):
		s1 = S.split(' ')
		s2 = ''
		for i in s1:
			s2 += i[0]
		return s2


class Solution:

	def firstAlphabet(self, S):
		str_ans = S[0]
		l = []
		for i in range(len(S)):
			if S[i] == ' ':
				l.append(i)
		str_ans2 = ''
		for i in l:
			str_ans2 += S[i + 1]
		str_ans += str_ans2
		return str_ans


class Solution:

	def firstAlphabet(self, S):
		li = S.split()
		st = ''
		for word in li:
			st += word[0]
		return st


class Solution:

	def firstAlphabet(self, S):
		a = S.split()
		b = []
		for i in a:
			b.append(i[0])
		c = ''.join(b)
		return c


class Solution:

	def firstAlphabet(self, S):
		ls = []
		res = ''
		for i in S:
			ls.append(i)
		idx = [-1]
		for i in range(0, len(ls)):
			if ls[i] == ' ':
				idx.append(i)
		for i in idx:
			res = res + S[i + 1]
		return res


class Solution:

	def firstAlphabet(self, S):
		ans = S.split()
		result = ''
		for i in range(len(ans)):
			re = ans[i]
			result += re[0]
		return result


class Solution:

	def firstAlphabet(self, S):
		new = ''
		for j in S.split():
			new = new + j[0]
		return new


class Solution:

	def firstAlphabet(self, S):
		words = S.split()
		word = ''
		for i in range(len(words)):
			word += words[i][0]
		return word


class Solution:

	def firstAlphabet(self, s):
		l = s.split()
		s1 = ''
		for i in l:
			s1 += i[0]
		return s1


class Solution:

	def firstAlphabet(self, S):
		d = ''
		for x in S.split():
			d += x[0]
		return d


class Solution:

	def firstAlphabet(self, S):
		s = ''
		l = S.split(' ')
		for value in l:
			s += value[0]
		return s


class Solution:

	def firstAlphabet(self, S):
		m = S.split(' ')
		p = ''
		for i in m:
			p += i[0]
		return p


class Solution:

	def firstAlphabet(self, S):
		ans = []
		S = S.split(' ')
		for word in S:
			ans.append(word[0])
		return ''.join(ans)


class Solution:

	def firstAlphabet(self, S):
		str = ''
		flag = True
		for i in range(len(S)):
			if S[i] == ' ':
				flag = True
			elif S[i] != ' ' and flag == True:
				str += S[i]
				flag = False
		return str


class Solution:

	def firstAlphabet(self, S):
		r = ''
		S1 = S.split()
		for i in S1:
			r = r + i[0]
		return r


class Solution:

	def firstAlphabet(self, S):
		a = ''
		for char in S.split(' '):
			a += char[0]
		return a


class Solution:

	def firstAlphabet(self, S):
		a = ''
		k = S.split()
		for i in k:
			a += i[0]
		return a


class Solution:

	def firstAlphabet(self, s):
		a = []
		a.append(s[0])
		for i in range(len(s)):
			if s[i] == ' ':
				a.append(s[i + 1])
		a = ''.join(a)
		return a


class Solution:

	def firstAlphabet(self, S):
		S = S.split()
		first = [x[0] for x in S]
		return ''.join(first)


class Solution:

	def firstAlphabet(self, S):
		ch = ''
		for i in range(len(S)):
			if S[i] == ' ':
				ch = ch + S[i + 1]
			elif i == 0:
				ch = ch + S[i]
		return ch


class Solution:

	def firstAlphabet(self, S):
		s = ''
		l = list(S)
		s = l[0]
		for i in range(1, len(l)):
			if l[i] == ' ':
				s += l[i + 1]
		return s


class Solution:

	def firstAlphabet(self, S):
		first_letter = ''
		for word in S.split():
			first_letter += word[0]
		return first_letter


class Solution:

	def firstAlphabet(self, S):
		list1 = S.split()
		stringAnswer = ''
		for i in list1:
			stringAnswer += i[0]
		return stringAnswer


class Solution:

	def firstAlphabet(self, S):
		st = ''
		l = S.split(' ')
		for ch in l:
			st += ch[0]
		return st