Skip to content

Latest commit

 

History

History

switch-challenge

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Creating switch-challenge project

Learning about switch statements:

Complete the getLetter(s) function. It has one parameter: a string, s, consisting of lowercase English alphabetic letters (i.e., a through z). It must return A, B, C, or D depending on the following criteria:

  • if the first character in string s is in the set { a, e, i, o, u }, then return A
  • if the first character in string s is in the set { b, c, d, f, g }, then return B
  • if the first character in string s is in the set { h, j, k, l, m }, then return C
  • if the first character in string s is in the set { n, p, q, r, s, t, v, w, x, y, z }, then return D

Constraints:

  • 0 <= s <= 100, where |s| is the lentgh of s.
  • String s contains lowercase English alphabetic letters (i.e., a through z) only.

Sample input:

adfgt


Sample output:

A