Strings Tutorial, Complex Filters

From Progzoo
Jump to: navigation, search

These questions use the simple text file http://progzoo.net/greeks.txt - this file includes around three hundred characters from Greek legends.

You may want to review the following: Function composition with String

Andromeda

Andromeda was chained to a rock and left to be eaten by a sea monster. She also has the same letter at the beginning and at the end of her name.

Print those names where the first and last letters are the same (ignoring case).



[Font] [Default] [Show] [Resize] [History] [Profile]

Penelope

Penelope waited faithfully for her husband to return from the Trojan wars. She artfully employed embroidery to preserve her chastity.

The first two characters of her name are the same as the last two.

Identify the three characters who include have the same two letters at the end and at the beginning of their names.



[Font] [Default] [Show] [Resize] [History] [Profile]

Phosphor

The morning star Phosphor has the first three letters "pho" appearing later in the name.

Print the names where the first three characters show up later in the name.



[Font] [Default] [Show] [Resize] [History] [Profile]

Paris

Paris triggered the Trojan war by taking the beautiful Helen from her husband.

His name has an odd number of characters - the middle character is "r".

Print the names with an "r" in the middle.



[Font] [Default] [Show] [Resize] [History] [Profile]