Acronyms can really obviously narrow your message sensors
Python 3, 89
Saved a bunch of bytes thanks to SOPython.
a=input().lower()
d=input().lower().split()
h=tuple(a)==next(zip(*d))
print(h,h&(a in d))
The most complicated part of this solution is h=tuple(a)==next(zip(*d))
.
This unpacks the list d
into zip and then calls next
to return a tuple of the first element of each iterable passed into zip
which is then compared against a tuple of each letter in a (tuple(a)
).
Pyth, 19 18
&pqJrz0hCKcrw0)}JK
This prints the result in a rather odd format, like: TrueFalse
.
You can try it online or run the Test Suite.
Explanation:
&pqJrz0hCKcrw0)}JK :
rz0 rw0 : read two lines of input, and convert each to lower case
c ) : chop the second input on whitespace
J K : store the first line in J and the chopped second line in K
q hC : zip K and take the first element, check if it is the same as J
p : print and return this value
& }JK : and the value with whether J is in K, implicit print
CJam, 21 20 bytes
qeuN/)S/_:c2$s=_p*&,
Try this fiddle in the CJam interpreter or verify all test cases at once.
How it works
qeu e# Read from STDIN and convert to uppercase.
N/ e# Split at linenfeeds.
)S/ e# Pop the second line form the array.
S/ e# Split it at spaces.
_:c e# Push a copy and keep on the initial of each word.
2$s e# Push a copy of the line array and flatten it.
e# This pushes the first line.
= e# Check for equality.
_p e# Print a copy of the resulting Boolean.
* e# Repeat the word array 1 or 0 times.
& e# Intersect the result with the line array.
, e# Push the length of the result (1 or 0).