Java programozás/Egy Java program elemzése


package anagramma;

import java.io.*;

public class anagramma {

 private static BufferedReader br=new BufferedReader( new InputStreamReader (System.in));
 public static void main(String a[]) throws IOException
 {
   int i;
   System.out.print("Mondat:");
   String str=br.readLine();
   String mondat="";
   int len=str.length();
   for( i=0; i<len; i++)
   {
     char k=str.charAt(i);
     if( k!=' ')
     {
       mondat+=k;
     }
   }
   String forditott="";
   len=mondat.length();
   for( i=len-1; i>=0; i--)
      forditott+=mondat.charAt(i);
   if( mondat.compareTo(forditott)!=0)
      System.out.println("Nem anagramma!");
   else
      System.out.println("Anagramma");
 }

}