package visszafelé;
/**
 * @author Fenyvesi Tibor
 */
import java.io.*;

public class Visszafele {
    public static void main(String[] args) {

        // beolvasás BufferedReader-rel
        StringBuffer sb = null;
        BufferedReader br = null;
        String szó =null;
        try {
            br = new BufferedReader(new FileReader("vissza.txt"));
            szó = br.readLine();
            int hossz = szó.length();
            sb = new StringBuffer(hossz);
            for (int i = hossz-1; i >= 0; i--)
                sb.append(szó.charAt(i));
        }
        catch (FileNotFoundException fnfe) { // a fájl nem található
            System.err.println(fnfe.getMessage()); }
        catch (IOException ioe) { // általános I/O hiba
            System.err.println(ioe.getMessage()); }
        finally {
            if (br != null) {
                try { br.close(); }
                catch (IOException ioe) {/* hibaelnyelés */}
            }
        }
        // a szavak kiírása a képernyőre
        System.out.println(szó);
        System.out.println(sb.toString());

    }
}
