Friday, November 24, 2017

Quick Brown Fox Kattis Problem Solution In Java



//Nayeem Shahriar Joy, Applied Physics & Electronic Engineering, University of Rajshahi.
 
import java.util.Scanner
 
public class JavaApplication1
 
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner io=new Scanner(System.in);
int s1=Integer.parseInt(io.nextLine());
for(int i=0;i<s1;i++)
{
String s3=io.nextLine();
s3=s3.toLowerCase();
int[]a=new int[124];
for (int m = 0; m < a.length; m++) {
a[m] = 0;
}
boolean missing=false;
for(int j=0;j<s3.length();j++)
{
a[(int)s3.charAt(j)]++;
}
for(int k=97;k<=122;k++)
{
if(a[k]==0)
{
missing = true;
break;
}
}
if(missing)
{
System.out.print("missing ");
for(int f=97;f<=122;f++)
{
if(a[f]==0)
System.out.print((char)(f));
}
}
else
{
System.out.print("pangram");
}
System.out.println();
}
// TODO code application logic here
}
}

No comments:

Post a Comment