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()
package com.codegym.task.task18.task1803;
import java.io.FileInputStream;
import java.io.*;
import java.util.Scanner;
/*
Most frequent bytes
*/
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();
}
}