Untitled

mail@pastecode.io avatar
unknown
plain_text
18 days ago
665 B
2
Indexable
Never
import java.util.HashSet;
public class Pangram
{
 public static Boolean isPangram(String str)
{
 str=str.toLowerCase();
 HashSet<Character>alphabetSet=new HashSet();
 for(char C:str.toCharArray())
 {
  if(C>='a' && C<='z')
   {
    alphabetSet.add(C);
   }
 }
return alphabetSet.size()==26;
}
public static void main(String args[])
 {
  String sent="the quick brown fox jumps over a lazy dog";
  System.out.println("the given string is:\n"+sent);
  if(isPangram(sent))
  {
   System.out.println("The string is a pangram:");
   }
   else
   {
    System.out.println("The string is not a pangram:");
  }
 }
}
                            
Leave a Comment