public class Solution { public static void main(String[] args) throws IOException { String fname; Scanner scan = new Scanner(System.in); fname = scan.nextLine(); FileInputStream in = new FileInputStream(fname); int temp=in.read(); int c=0; while(in.available()>0) { int data=in.read(); if(data==temp){ temp=data; } System.out.print(" "+temp); } in.close()