Sedang Disiapkan

224538 PHP manipulation of word list

A php script is required for the comparison and manipulation of a list of words.

A list of words are entered into a text box, 1 word per line. The number of words entered is variable. For example:

America

China

England

France

Germany

India

Italy

Spain

Upon submitting the form, the following would be generated:

===========================================================

N

e

- Italy

- America

I

g

- France

r

- England

- Germany

H

S

- India

- Spain

- China

===========================================================

This 'tree' starts with the letter than occurs at least once in the greatest number of words apart from any that may occur in all of them. If there is more than one letter that occurs an equal greatest number of times, the letter that appears earliest in the following sequence is selected "EARIOTNSLCUHPMHDGBFYWKVXZJQ". In this case that letter is "N" which appears in France, Germany, England, Spain, India and China. In this stage of the tree, these words are ignored, leaving us only with Italy and America that both contain "N". The script now must print a letter that is present in only one of the words, this letter should be the first letter that occurs in the following sequence "EARIOTNSLCUHPMHDGBFYWKVXZJQ" - in this case "E".

The same process is now repeated with the remaining words France, Germany, England, Spain, India and China. "I" is the most frequently occuring letter from those words, appearing in Spain, India and China. Again these words are discarded till later, leaving us with France, Germany and England. "G" appears in two of the three words, so that is printed along with France, leaving England and Germany. "R" is the first letter form the above sequence that appears in only one of the words, so this is printed followed by England and Germany.

We are now left with the words Spain, India and China. The only letters that aren't contained in each of the words are H and D. H comes before D in the sequence so that is printed. Since China contains "H" it is discarded till later. We now have to split Spain and India. S is the first letter in the sequence "EARIOTNSLCUHPMHDGBFYWKVXZJQ" that is present in only one of the words, so that is printed along with India and Spain.

China is the only remaining word, so that is printed.

The script should be contained in a single php file. When the tree is genereated, the text box containing the entered words should be printed again so that changes can be made and the form resubmitted.

Any questions us PMB.

Thanks

Kemahiran: Semua Boleh, PHP

Lihat lebih lanjut: tree box, letter thanks, single letter, questions france, php india, manipulation, letter g, text manipulation, split file php script, file split php script, number manipulation, word print, print word, script tree, script france, single php, greatest, php process file, php split file, china script php, india list, italy list, list words, list word, times appears word

Tentang Majikan:
( 2 ulasan )

ID Projek: #1970774

Dianugerahkan kepada:

ashekthegreat

As discussed.

$25 USD dalam sehari
(21 Ulasan)
5.0