Pangrams

行内のアフファベットで使用していないものを表示。全部使ってたらNULLを出力。

設問

Description:

The sentence 'A quick brown fox jumps over the lazy dog' contains every single letter in the alphabet. Such sentences are called pangrams. You are to write a program, which takes a sentence, and returns all the letters it is missing (which prevent it from being a pangram). You should ignore the case of the letters in sentence, and your return should be all lower case letters, in alphabetical order. You should also ignore all non US-ASCII characters.In case the input sentence is already a pangram, print out the string NULL

Input sample:

Your program should accept as its first argument a filename. This file will contain several text strings, one per line. Ignore all empty lines. eg.

A quick brown fox jumps over the lazy dog
A slow yellow fox crawls under the proactive dog
Output sample:

Print out all the letters each string is missing in lowercase, alphabetical order .e.g.

NULL
bjkmqz

Submit your solution in a file (some file name).(py| c| cpp| rb| pl| php| tcl| clj| js| scala| cs| m) | pangrams.java|pangrams.scala or use the online editor.

Sponsored Challenge Eligibility

In order to be eligible to push solution to the employer (Ampush Social), you must satisfy the following conditions:

やってみた

#!/usr/bin/env ruby

ALL_ALPHABET = [*'a'..'z']

def unused_letters(str)
  ALL_ALPHABET - str.downcase.split(//).uniq
end

ARGF.lines do |line|
  diff = unused_letters(line.chomp)
  puts diff.size.zero? ? 'NULL' : diff.join
end