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

Home > General
One-liners (Posted on 2015-09-09) Difficulty: 3 of 5
a. (easy) What is the only U.S. state name that can be typed on a single row of keys on a standard QWERTY typewriter?

b. (harder) What are the countries,which names can be typed like in a.

c. (difficult) Same for capitals (of countries and US states).

See The Solution Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution mostly computer solution | Comment 1 of 4
a. non-computer: Alaska
b. computer: Peru
c. computer: Dhaka, Bangladesh,
   Quito, Ecuador

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 = LTrim(RTrim(LCase(l)))
   If Len(l) > 1 Then
     good1 = 1
     For i = 1 To Len(l)
       If InStr("qwertyuiop", Mid(l, i, 1)) = 0 Then good1 = 0: Exit For
     Next
     good2 = 1
     For i = 1 To Len(l)
       If InStr("asdfghjkl", Mid(l, i, 1)) = 0 Then good2 = 0: Exit For
     Next
     good3 = 1
     For i = 1 To Len(l)
       If InStr("zxcvbnm", Mid(l, i, 1)) = 0 Then good3 = 0: Exit For
     Next
     If good1 Or good2 Or good3 Then
       Text1.Text = Text1.Text & l & crlf
     End If
   End If
 
 Loop Until EOF(1)
 Close
 
 Text1.Text = Text1.Text & crlf
 
 Open "capital of country.txt" For Input As #1
 Do
   Line Input #1, l$
   l = LTrim(RTrim(LCase(l)))
   ls$ = l
   ix = InStr(l, ",")
   If ix Then l = Left(l, ix - 1)
   If Len(l) > 1 Then
     good1 = 1
     For i = 1 To Len(l)
       If InStr("qwertyuiop", Mid(l, i, 1)) = 0 Then good1 = 0: Exit For
     Next
     good2 = 1
     For i = 1 To Len(l)
       If InStr("asdfghjkl", Mid(l, i, 1)) = 0 Then good2 = 0: Exit For
     Next
     good3 = 1
     For i = 1 To Len(l)
       If InStr("zxcvbnm", Mid(l, i, 1)) = 0 Then good3 = 0: Exit For
     Next
     If good1 Or good2 Or good3 Then
       Text1.Text = Text1.Text & ls & crlf
     End If
   End If
 
 Loop Until EOF(1)
 Close
  
 Text1.Text = Text1.Text & crlf & " done"
  
End Sub


Files adapted from Wikipedia lists. Additional tidbit of information about Quito, Equador: "highest official capital (2,850 m).[8]"



  Posted by Charlie on 2015-09-09 15:49:58
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 (5)
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