title: Counting numbers and letters
body: <p>I have to write a program that has to read a set of 13 cards in a  String with inputs like C3567JD798S4H687 (C standing for Clubs, D for Diamonds, S for Spades, H for Hearts) and the output needs to separate each suit on a different line so on one line you will have C3567J and on the next you would have D798 etc. </p>
  
  <p>I am not very sure on how to have the program recognize the end of a suit like when to start a new count once it reads a D or S.  </p>
  
  <p>So far I have only figured out how to separate letters and numbers which I had thought would be the first step.</p>
  
  <p>Here is my code: </p>
  
  <pre><code>import java.io.* ;
  public class Cards  
  {
  
     public static void main (String[] args) throws IOException 
     {
          BufferedReader objReader = new BufferedReader (new InputStreamReader (System.in));
  
  
      System.out.print("Enter cards:");
      String cards = objReader.readLine ();
  
            Test obj = new Test (cards);
            String gC = obj.GetCards();
            String gN = obj.GetNumber();
  
     System.out.println("Letters" + suitC);
     System.out.println("Numbers" + numbers);
     }
  }
  class Test 
     {
       private String suitC = "";
       private String numbers = "";
  
       Test (String sC, String n)
       {
         suitC = sC;
         numbers = n;
       }
       private void Separation(String s)
       {
        for (int i = 0; i &lt; s.length(); i++)
        {
          char a = s.charAt(i);
          if (Character.isDigit(a)) 
          {
            suitC = suitC + a;
          } 
          else 
          {
            numbers = numbers + a;
          }
        }
       }
  
       String GetSuitC()
       {
           return suitC;
       }
       String GetNumber()
       {
        return numbers; 
       }
     }
  </code></pre>