title: Debugging help facebook hacakathon problemset
body: <p>I am trying to implement one of the simpler questions that was on the facebook hackathon 2013 
                                                                                                   http://argote.mx/?p=353"> here .</p>
  
  <p>Excerpt:
   <strong>Given a string s, little Johnny defined the beauty of the string as the sum of the beauty of the letters in it.
  The beauty of each letter is an integer between 1 and 26, inclusive, and no two letters have the same beauty. Johnny doesn't care about whether letters are uppercase or lowercase, so that doesn't affect the beauty of a letter.You're a student writing a report on the youth of this famous hacker. You found the string that Johnny considered most beautiful. What is the maximum possible beauty of this string?</strong></p>
  
  <p>I've implemented my own solution based on mapping individual letters to a particular number.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>package samplecodes;
  
  import java.io.BufferedReader;
  import java.io.FileReader;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.StringTokenizer;
  
  public class StringBeauty {
  
      /**
       * @param args
       */
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          ArrayList&lt;String&gt; input= new ArrayList&lt;String&gt;();
          try{
  
              FileReader f1 = new FileReader(args[0]);
              BufferedReader f = new BufferedReader(f1);
              String newLine;
              while ((newLine=f.readLine()) != null){
                     StringTokenizer st = new StringTokenizer(newLine);
                     while (st.hasMoreTokens()) {
                        String string= st.nextToken(); 
                        input.add(string);
  
                     }
  
                     for(String i: input)
                         System.out.println("input "+i);
                     ///printLower(input);
  
                     calculateStringBeauty(input);
                     input.clear();
  
  
  }
  
          }
  
              catch(Exception e){
                  e.printStackTrace();
          }
      }
  
  
      public static void calculateStringBeauty(ArrayList&lt;String&gt; input){
  
          /** mapping based on analysing input string**/
  
          HashMap&lt;Character,Integer&gt; map= new HashMap&lt;Character,Integer&gt;();
          map.put( Character.valueOf('a'),24);
          map.put( Character.valueOf('b'),25);
          map.put( Character.valueOf('c'),26);
          map.put( Character.valueOf('d'),1);
          map.put( Character.valueOf('e'),2);
          map.put( Character.valueOf('f'),3);
          map.put( Character.valueOf('g'),4);
          map.put( Character.valueOf('h'),5);
          map.put( Character.valueOf('i'),6);
          map.put( Character.valueOf('j'),7);
          map.put( Character.valueOf('k'),8);
          map.put( Character.valueOf('l'),9);
          map.put( Character.valueOf('m'),10);
          map.put( Character.valueOf('n'),11);
          map.put( Character.valueOf('o'),12);
          map.put( Character.valueOf('p'),13);
          map.put( Character.valueOf('q'),14);
          map.put( Character.valueOf('r'),15);
          map.put( Character.valueOf('s'),16);
          map.put( Character.valueOf('t'),17);
          map.put( Character.valueOf('u'),18);
          map.put( Character.valueOf('v'),19);
          map.put( Character.valueOf('w'),20);
          map.put( Character.valueOf('x'),21);
          map.put( Character.valueOf('y'),22);
          map.put( Character.valueOf('z'),23);
          int sum=0;
          for(String i: input){
          i=i.toLowerCase();
          //  System.out.println("i "+i);
          char[] array= i.toCharArray();
  
          for(char a: array){
          if(map.containsKey(a))
              sum+=map.get(a);
          else
              continue;
          }
  
          }
          System.out.print(sum);
          System.out.println();
  
          }
  }
  </code></pre>
  
  <p>My solution seems to work perfectly for one of the test cases 
   e.g . <code>ABbCcc</code> -> <code>152</code>, this maps correctly
   However <code>So I just go consult Professor Dalves</code>  -> <code>392</code> (according to my code). But is expected to return a beauty value of <code>646</code> according to the test case provided.
  <br/>
  <br/>
  Any help in debugging my code or suggestions to improve my algorithm would be appreciated.</p>