Missing Letters

Given a word the task is to find and print only the missing letters between the highest and lowest ASCII characters from that word. Convert the word to lower case for convenience.

Example: “coding”. Here highest and lowest ASCII characters are ‘c’ and ‘o’.

Therefore the missing elements are: e f h j k l m.

Java
import java.util.*;
public class MissingLetters
{
    public static void main(String args[])
    {
        int l=0,flag=0;
        String str="";
        char ch=' ',maxCh='a',minCh='z';
        Scanner sc=new Scanner(System.in);
        System.out.print("Enter a word: ");
        str=sc.next();
        str=str.trim();
        str=str.toLowerCase();
        l=str.length();
        for(int i=0;i<l;i++)
        {
            ch=str.charAt(i);
            if(ch>maxCh)
            {
                maxCh=ch;
            }
            if(ch<minCh)
            {
                minCh=ch;
            }
        }
        System.out.print("Missing letters are: ");
        for(;minCh<maxCh;minCh++)
        {
            flag=1;
            for(int i=0;i<l;i++)
            {
                ch=str.charAt(i);
                if(ch==minCh)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                System.out.print(minCh+" ");
            }
        }
    }
}
Java