import java.io.*; public class Fail{ public static void main(String arg[]) throws IOException{ String stroka,bukva,fail,slovo,vorto; PrintWriter ekran=new PrintWriter(System.out, true); BufferedReader vvod=new BufferedReader ( new InputStreamReader(System.in)); ekran.println("Sisastage palun faili nimi."); fail=vvod.readLine(); ekran.println("Sisastage palun vaadeldav taht."); slovo=vvod.readLine(); bukva=slovo.substring(0,1); RandomAccessFile f=new RandomAccessFile(fail, "r"); RandomAccessFile f2=new RandomAccessFile("output.log","rw"); stroka=f.readLine(); vorto=""; while(stroka!=null){ for(int n=1;n1){f2.writeChars(vorto);} vorto="";} vorto=vorto+stroka.substring(n,n+1); } stroka=f.readLine(); } } }