How to strip capital letters and then put them back in again in the same place?
<p>I need to input a sentence with a mixture of capital and lower case letters, and output the positions of each word. However if one word is in capitals and the same word only in lower case is entered it is counted as a separate word. eg. if book and BOOK is entered these will be counted as 2 separate words. I have tried using the .upper/.lower function, but there is no way to put the capital letters back in after doing so? I need the capital letters to be removed and then put back in again after.</p>

<pre><code>    def analyse_sentence():
       sentence=input("Please enter your sentence")
       sentence=sentence.split
       compression(sentence)

    def compression(sentence):
        positions=[]
        Unique_words=[]
    for i in sentence:
      if i not in unique:
         unique.append(i)
         positions.append(unique_words.index(i)+1)
</code></pre>