Respuesta :

Answer:

Here is code in java.

import java.util.*;

class Main

{// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    //scanner class object to read input

       Scanner in=new Scanner(System.in);

       String inp_str;

       // array to keep count of all alphabets

       int[] arr = new int[26];

       int j=0;

       int flag=1;

       System.out.println("Enter the String:");

       // read input

       inp_str=in.nextLine();

     // find length of the string input

       int len=inp_str.length();

       // increase the count of each alphabet

       for(int i=0;i<len;i++)

       {

           if ('A' <= inp_str.charAt(i) && inp_str.charAt(i) <= 'Z')

           {

                         

               j = inp_str.charAt(i) - 'A';

           }

               

 

               

           else if('a' <= inp_str.charAt(i) && inp_str.charAt(i) <= 'z')

           {

                             

               j = inp_str.charAt(i) - 'a';

               

           }

 

           

           arr[j] = arr[j]+1;

         

       }

       // check if count of any alphabet is 0

       for(int i=0;i<26;i++)

       {

           

           if(arr[i]==0)

           {

             

               flag=0;

               break;

           }

       }

     

     // print the output

      if(flag==1)

      {

           System.out.println("String is pangram.");

      }

       else

       {

           System.out.println("String is not pangram.");

       }

       

       

       

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read the string from user. Create an array "arr[26]" of size to keep count of each character. Travers all the string and if a character is present then increase  the count corresponding to that character in the array.After this if there is count of any character is 0 then print not pangram else print string is pangram.

Output:

Enter the String:                                                                                    

hello world welcome to java                                                                 String is not pangram.

Enter the String:                                                        

The quick brown fox jumps over the lazy dog                                     String is pangram.

ACCESS MORE