Problem B
Countries
Write a program that reads from a file, in this case named "countries.txt". An example of such a file is provided alongside the starter code. It is guaranteed that the file will exist and is accessible by the name "/src/countries.txt".
The program should find all countries listed in the file that end with a given suffix. Note that the comparison should be case sensitive.
Submission instructions
Note that we are NOT testing any function specifically, so your solution must handle the input and output itself!
It is a good idea for you to break the program down into bite-sized parts and implement each part as a function, because it makes it easier to develop and understand the program, but the structure of your code will not be tested, only what outputs it produces given certain inputs.
Input
The input consists of one line containing a string
For your informatoin, in the test cases,
Output
Let
{N} countries with suffix {s} in
total.
Sample Input 1 | Sample Output 1 |
---|---|
land |
Finland Iceland Republic of Ireland New Zealand Poland Swaziland Switzerland Thailand 8 countries with suffix land in total. |
Sample Input 2 | Sample Output 2 |
---|---|
ia |
Albania Algeria Armenia Australia Austria Bolivia Bulgaria Cambodia Colombia Croatia Estonia Ethiopia Gambia Georgia India Indonesia Latvia Liberia Lithuania Macedonia Malaysia Mauritania Micronesia Mongolia Namibia Nigeria Romania St Lucia Saudi Arabia Serbia Slovakia Slovenia Somalia Syria Tanzania Tunisia Zambia 37 countries with suffix ia in total. |
Sample Input 3 | Sample Output 3 |
---|---|
thereisprobablynocountrywiththissuffix |
0 countries with suffix thereisprobablynocountrywiththissuffix in total. |