Mathematical and Physical Journal
for High Schools
Issued by the MATFUND Foundation
Already signed up?
New to KöMaL?

Problem I. 322. (May 2013)

I. 322. Many of us like playing various word games. Rules are typically illustrated by giving examples or solutions. For the following word games, we have used the novel Egri csillagok by Géza Gárdonyi as a source. The file szoveg.txt downloadable from our site contains selected words from this novel; all written in lowercase letters of the English alphabet, having length at most 20 characters, and each word is put in a separate line to make their processing easier.

Your program i322 should solve the following tasks by using the words of the szoveg.txt file given as a command line argument to your program. Your solution should be able to handle input text files of arbitrary length.

Whenever the output of your program is to appear on the screen, the number of the actual task should be displayed. If the program prompts the user for input, display what kind of data is expected (for the first task, for example, ``Task #1: Please enter a word:''). By default, the words in your screen output should be separated by a space character. Diacritical marks in the output can be omitted.

1. Ask the user to enter a word and decide whether it contains only one kind of vowel of the English alphabet (a, e, i, o, u). If yes, then display ``It contains only one kind of vowel''. If the entered word contains none or more than one kind, then display ``The statement is false''. We can suppose that the entered word contains only lowercase English letters.

2. Count and display the number of words of the file szoveg.txt in each of the following categories: words with only back vowels (a, o or u), words with only front vowels (e or i), and words with both back and front vowels. You should also display the size of these groups compared to the total number of words, expressed as percentages to 2 decimal digits.

For example:

3. Ask the user to enter a string (that is, characters without spaces) of length of at most 20 characters, then collect and display on the screen all the words that contain this string.

4. Collect and display on the screen all the words that consist of letters in alphabetical order.

For example:

5. Collect the words such that by omitting their first and last letters we get a word also from the file szoveg.txt.

6. Find and display 10 words from the list that can be cut into two identical parts.

Two examples:

7. Create a file kettevag.txt containing 100 words from the list, each in a separate line, with the following property: if a word is suitably cut into two (not necessarily in the middle), then the resulting two parts are also words from the file szoveg.txt.

Two examples:

The source code (i322.pas, i322.cpp, ...) together with a short documentation of your program (i322.txt, i322.pdf, ...), also containing the name of the developer environment to use for compiling and a brief description of your solution, should be submitted in a compressed file (

Downloadable file: szoveg.txt

(10 pont)

Deadline expired on June 10, 2013.

Sorry, the solution is available only in Hungarian. Google translation


Varga Erik 12. évfolyamos tanuló (Budapest, Berzsenyi Dániel Gimnázium) programját mutatjuk be: i322.cpp


10 students sent a solution.
10 points:Csernák Tamás, Fehér Balázs, Fényes Balázs, Gema Barnabás, Kalló Kristóf, Németh 017 András, Tegzes Tamás, Varga 256 Erik.
9 points:Jeges Viktor.
3 points:1 student.

Problems in Information Technology of KöMaL, May 2013