blob: 2205d7c5517625ebdabcb4dcd36de007e2ec64aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
Mendeleev — find chemical elements in words.
For example, the word "Moscow" can be split in the following ways:
Mo S C O W,
Mo S Co W,
Mo Sc O W,
where:
Mo — Molybdenum,
S — Sulfur,
Sc — Scandium,
C — Carbon,
Co — Cobalt,
W — Wolfram (Tungsten).
When a character cannot be found among the chemical elements, it's replaced
with a question mark:
language -> La N ? U Ag ?
There are implementations in several programming languages. Each program
accepts words as arguments and prints all the possible combinations,
for example:
$ ./mendeleev-c preprocessor
preprocessor:
P Re P ? O C Es S O ?
P Re P ? O Ce S S O ?
P Re Pr O C Es S O ?
P Re Pr O Ce S S O ?
Pr ? P ? O C Es S O ?
Pr ? P ? O Ce S S O ?
Pr ? Pr O C Es S O ?
Pr ? Pr O Ce S S O ?
This software is Public Domain. See the LICENSE file for details.
Dmitri Ivanovich Mendeleev (1834–1907) was a Russian chemist and inventor
known for formulating the Periodic Law.
|