All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General > Word Problems
One of the countries (Posted on 2015-07-22) Difficulty: 3 of 5
PERU is NOT the longest name of a country consisting of alternating vowels and consonants.

Neither is CANADA.

What is?

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 1 of 2
Neither is it the 8-letter Dominica, Kiribati or Suriname, as I had thought after running the first version of the program. Then I got to thinking it's supposed to be one country. Well, maybe we should ignore spaces, so the revised program ignores spaces, and here's the list of countries matching the criterion, with their name lengths:

5 aruba
7 belarus
6 belize
5 benin
6 canada
7 comoros
4 cuba
8 dominica
4 fiji
5 gabon
4 iran
4 iraq
5 italy
5 japan
8 kiribati
6 kosovo
7 lebanon
6 malawi
4 mali
6 mexico
6 monaco
5 nepal
5 niger
4 oman
6 panama
4 peru
5 qatar
7 senegal
5 sudan
8 suriname
4 togo
6 tuvalu
20 united arab emirates

United Arab Emirates is the longest, with, actually, 18 letters and two spaces.

DefDbl A-Z
Dim crlf$


Private Sub Form_Load()
 Form1.Visible = True
 
 Text1.Text = ""
 crlf = Chr$(13) + Chr$(10)

 Open "country list.txt" For Input As #1
 Do
   Line Input #1, l$
   l = LCase(LTrim(RTrim(l)))
   If Len(l) > 1 Then
        If Left(l, 1) < "a" Or Left(l, 1) > "z" Then l = Mid(l, 2)
        good = 1
        For i = 1 To Len(l)
         If Mid(l, i, 1) >= "a" And Mid(l, i, 1) <= "z" Then
          prevvowel = vowel
          If InStr("aeiouy", Mid(l, i, 1)) > 0 Then vowel = 1 Else vowel = 0
          If i > 1 And vowel = prevvowel Then good = 0: Exit For
         End If
        Next
        If good Then Text1.Text = Text1.Text & Len(l) & " " & l & crlf
   End If
 Loop Until EOF(1)
 Close 1
 
 
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub


  Posted by Charlie on 2015-07-22 15:46:50
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information