title: Python: Is there a way to find and remove the first and last occurrence of a character in a string?
body: <p>The problem:</p>
  
  <p>Given a string in which the letter h occurs at least twice.
  Remove from that string the first and the last occurrence of
  the letter h, as well as all the characters between them.</p>
  
  <p>How do I find the first and last occurrence of h? And how can I remove them and the characters in between them?</p>
  
  <pre><code>#initialize the index of the input string
  index_count =0
  
  #create a list to have indexes of 'h's
  h_indexes = []
  
  #accept input strings
  origin_s = input("input:")
  
  #search 'h' and save the index of each 'h' (and save indexes of searched 'h's into h_indexes
  for i in origin_s:
  
  first_h_index =
  last_h_index = 
  
  #print the output string
  print("Output:"+origin_s[     :     ]+origin_s[     :])
  </code></pre>