title: I'm trying to perform some manual encoding of strings using python
body: <p><strong>Probelm Description:</strong></p>
  
  <p><strong>sms_encoding()</strong> which accepts a sentence and converts it into an abbreviated sentence to be sent as SMS and returns the abbreviated sentence. </p>
  
  <p>Rules are as follows:</p>
  
  <p><strong>a. Spaces are to be retained as is</strong> </p>
  
  <p><strong>b. Each word should be encoded separately</strong></p>
  
  <p><strong>If a word has only vowels then retain the word as is
  If a word has a consonant (at least 1) then retain only those consonants</strong></p>
  
  <p>My Code:</p>
  
  <pre><code>#PF-Assgn-50
  
  def sms_encoding(data):
      #start writing your code here
      vowels=set("aeiouAEIOU")
      v_list=[]
      c_list=[]
      final_list=[]
      new_string=''
      word=data.split()
      word2=[]
      for i in range(0,len(word)):
         ch=word[i]
         #print(ch)
         if ch in vowels: 
             v_list.append(ch)
         for letter in word[i]:
         if letter not in vowels:
             c_list.append(letter)
         c_list.append(" ")
  
  
      new_string=''.join(v_list)+''.join(c_list)
      final_list.append(new_string)
  
      #print(v_list)
  
      return ' '.join(final_list)
  
  
  data="Have a Nice Day"
  print(sms_encoding(data))
  </code></pre>
  
  <p>My Output:</p>
  
  <pre><code>aHv **&lt;2spaces&gt;** Nc **&lt;1space&gt;** Dy
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>Hv a Nc Dy (contains only 1 space)
  </code></pre>