title: Counting unique words
body: <p><strong>Question:</strong></p>
  
  <p>Devise an algorithm and write the Python code to count the number of unique words in a given passage. </p>
  
  <p>The paragraph may contain words with special characters such as <code>!</code>, <code>?</code>, <code>.</code>, <code>,</code> , <code>:</code> and <code>;</code> and digits are not permitted. </p>
  
  <p>Special character must occur only at the end of a word in a passage that is <code>Hello World!</code> is valid but <code>Hello !World</code> or <code>Hello Wor!ld</code> is invalid. </p>
  
  <p>No two special character occur together. Print <code>Invalid input</code> for such cases. </p>
  
  <p>Count words without special characters. Counting must case insensitive. Print words in lower case and in sorted order.</p>
  
  <p><strong>My code:</strong></p>
  
  <pre><code>import sys
  from pprint import pprint`
  import re
  line=raw_input()
  line.lower()
  l=line.split(" ")
  d=set(l)
  count={}
  for word in d:
      if word in count:
          count[word]+=1
      else:
          count[word]=1
  pprint(count)
  </code></pre>
  
  <p>Expected Output:</p>
  
  <pre><code>{'are': 2, 'better': 1, 'dear': 2, 'how': 1, 'you': 2}
  </code></pre>
  
  <p>My Program Output:</p>
  
  <pre><code>{'Are': 1, 'How': 1, 'are': 1, 'better': 1, 'dear?': 1, 'you': 1}
  </code></pre>