You are viewing a single comment's thread. Return to all comments →
public static void main(String[] args) { Scanner in = new Scanner(System.in); String str = in.nextLine(); BitSet bs = new BitSet(25); str = str.toLowerCase(); for( int i = 0; i < str.length(); i++ ) { if( Character.isLetter(str.charAt(i)) ) { bs.set(str.charAt(i) - 97); } } if( bs.cardinality() == 26 ) { System.out.println("pangram"); } else { System.out.println("not pangram"); } }
I had the same idea! Although yours is a little more efficient.
Seems like cookies are disabled on this browser, please enable them to open this website
Pangrams
You are viewing a single comment's thread. Return to all comments →
I had the same idea! Although yours is a little more efficient.