Computer Science, asked by ramramudu51, 7 months ago

The first linenof the input consists of a string word 1 representing the first word, The second line consists representing the second word2 representing second word​

Answers

Answered by nathpratima16
0

Answer:

The first linenof the input consists of a string word 1 representing the first word, The second line consists representing the second word2 representing second word

Answered by yashaswi084
0

Answer: code is below of String containing first letter of every word in a given string with spaces

Explanation:

def firstLetterWord(str):

   result = ""

   # Traverse the string.

   v = True

   for i in range(len(str)):

       

       # If it is space, set v as true.

       if (str[i] == ' '):

           v = True

       # Else check if v is true or not.

       # If true, copy character in output

       # string and set v as false.

       elif (str[i] != ' ' and v == True):

           result += (str[i])

           v = False

   return result

# Driver Code

if __name__ == "__main__":

   

   str = "geeks for geeks"

   print(firstLetterWord(str))

Similar questions