1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import static de.nplusc.hhn.ZipInvert.invert;
- import java.io.BufferedReader;
- import java.io.InputStreamReader;
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author LH
- */
- public class Palindromtest
- {
- public static void main(String[] args) throws Exception //unfein; amchs nur wegen ihrer doofen limitierung
- {
- //System.out.println("dbg1");
- BufferedReader kb = new BufferedReader(new InputStreamReader(System.in));
- //System.out.println("dbg2");
- //System.out.print()
- System.out.print("Bitte Wort eingeben :");
- String line = kb.readLine();
- while(line!=null)
- {
- String rslt = (line.equals(invert(line))?"":"Kein ")+"Palindrom";
- System.out.println(rslt);
- line = kb.readLine();
- }
- }
-
- public static String invert(String in)
- {
- return in.length()<2?in:invert(in.substring(1))+in.substring(0,1);
- }
- }
|