title: given a word, print its index, words can be increased accordingly
body: <p>Imagine an alphabet of words.</p>
  
  <p>Example: </p>
  
  <pre><code> a ==&gt; 1 
   b ==&gt; 2 
   c ==&gt; 3 
  
   z ==&gt; 26 
   ab ==&gt; 27 
   ac ==&gt; 28 
  
   az ==&gt; 51 
   bc ==&gt; 52 
   and so on. 
  </code></pre>
  
  <p>Such that the sequence of characters need to be in ascending order only (ab is valid but ba is not). Given any word print its index if valid and 0 if not. </p>
  
  <pre><code> Input  Output 
  
   ab      27 
  
   ba       0 
  
   aez     441 
  </code></pre>
  
  <p>In this question, I can do math easily but I am not getting any algorithm.</p>
  
  <p>What i did in math is</p>
  
  <p>one letter 26</p>
  
  <p>two letter 325</p>
  
  <p>.</p>
  
  <p>.</p>
  
  <p>.</p>
  
  <p>so on</p>