All pastes #206001 Raw Edit

Something

public text v1 · immutable
#206001 ·published 2006-10-17 05:09 UTC
rendered paste body
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Vector;
import java.util.Enumeration;
import java.util.regex.*;

       

      public class Descramble {

          public static void main(String[] args) {

              int counter = 0;

              Vector words = new Vector();

       

              String inputLine;

              try {   

                  BufferedReader is = new BufferedReader(new InputStreamReader(System.in));

              

                  inputLine = is.readLine();

                  while (!inputLine.equals("end")) {

                      words.add(inputLine);

                      counter++;

                      inputLine = is.readLine();

                  }

                  is.close();

              } catch (IOException e) {

                  e.printStackTrace();

              }   

       

              for(Enumeration e = words.elements(); e.hasMoreElements();) {
//            	  String input = e.nextElement().toString();
            	  Pattern r = Pattern.compile("\\W+");
                  Matcher m = r.matcher(e.nextElement().toString());
            	  System.out.println(e.nextElement());
            	  m.replaceAll("");
            	  m.reset();
              }

          }

      }