Problem Statement
The normalized form of a user name is the form in which all spaces are removed and all capital letters are converted to lower case.
Thus the user names "username" and "Us Er Na Me" do not have unique normalized forms.
You are to write a class Normalizer which contains a method normalize. The method takes a
Definition
- Class:
- Normalizer
- Method:
- normalize
- Parameters:
- String
- Returns:
- String
- Method signature:
- String normalize(String userName)
- (be sure your method is public)
Constraints
- userName contains between 1 and 50 characters, inclusive.
- userName contains at least 1 non-space character.
- userName contains lowercase and capital letters, digits, and spaces (a-z, A-Z, 0-9).
Examples
" thIS1201982 Is a TEst"
Returns: "this1201982isatest"
" K "
Returns: "k"
" 1 1 1"
Returns: "111"
" HiHoWaRe YOU"
Returns: "hihowareyou"
"nochangehere"
Returns: "nochangehere"
" 11111iiii1111 "
Returns: "11111iiii1111"
"THISISAREALLYLONGUSERNAME12345678899"
Returns: "thisisareallylongusername12345678899"
"123456789012345678901234567890123456789"
Returns: "123456789012345678901234567890123456789"
" l"
Returns: "l"
"s df ssdf dsf sdf SDFSF SDF SDFSDF SDF DF"
Returns: "sdfssdfdsfsdfsdfsfsdfsdfsdfsdfdf"
"username"
Returns: "username"
"Us Er Na Me"
Returns: "username"
"HI133"
Returns: "hi133"
" helloOoOo"
Returns: "hellooooo"
"a"
Returns: "a"
" 1 "
Returns: "1"
"a 1 1"
Returns: "a11"
"AbC 123 aBC 123"
Returns: "abc123abc123"
"user name"
Returns: "username"
"Te s t 1 2 3 FFFa1"
Returns: "test123fffa1"
"a b"
Returns: "ab"
"numberals 123"
Returns: "numberals123"
"username"
Returns: "username"
"Us Er Na Me"
Returns: "username"
"HI133"
Returns: "hi133"
" helloOoOo"
Returns: "hellooooo"
"a"
Returns: "a"
" 1 "
Returns: "1"