Source code for submission s573

bugs.java

  1.  
  2. import java.util.StringTokenizer;
  3. import java.io.BufferedReader;
  4. import java.io.InputStreamReader;
  5.  
  6. /**
  7.  *
  8.  * @author cteam049
  9.  */
  10. public class bugs {
  11.  
  12. /**
  13.   * @param args the command line arguments
  14.   */
  15. public static void main(String[] args)
  16. {
  17. bugs program = new bugs();
  18. program.run();
  19. }
  20.  
  21. protected void run()
  22. {
  23. try
  24. {
  25. for ( ;; )
  26. {
  27. int lines = this.nextInt();
  28. String replacement = this.nextToken();
  29. // String tmp = this.nextLine();
  30. String line;
  31. int oldLen;
  32.  
  33. for ( int i = 0; i < lines; i++ )
  34. {
  35. line = this.nextLine();
  36. do
  37. {
  38. oldLen = line.length();
  39. line = line.replace( replacement, "" );
  40. } while( oldLen != line.length() );
  41.  
  42. System.out.println( line );
  43. }
  44. }
  45. } catch ( Exception e )
  46. {
  47. e.printStackTrace();
  48. }
  49. }
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. /* INPUT READING */
  59.  
  60.  
  61.  
  62.  
  63. public String nextToken() throws Exception
  64. {
  65. while ( ! st.hasMoreTokens() )
  66. {
  67. st = new StringTokenizer( input.readLine() );
  68. }
  69. return st.nextToken();
  70. }
  71.  
  72.  
  73.  
  74. public int nextInt() throws Exception
  75. {
  76. return Integer.parseInt( this.nextToken() );
  77. }
  78.  
  79.  
  80.  
  81. public String nextLine() throws Exception
  82. {
  83. return input.readLine();
  84. }
  85. }
  86.