Correct variable names consist only of English letters, digits and underscores and they can't start with a digit.
Check if the given string is a correct variable name.
Example
name = "var_1__Int", the output should be**solution(name) = true**;name = "qq-q", the output should be**solution(name) = false**;name = "2w2", the output should be**solution(name) = false**.Input/Output
[execution time limit] 3 seconds (java)
[memory limit] 1 GB
[input] string name
Guaranteed constraints:
1 ≤ name.length ≤ 10.
[output] boolean
true if name is a correct variable name, false otherwise.
boolean solution(String name) {
// 첫 문자 숫자 확인용 정규화
String REGEXP_PATTERN_NUMBER = "^[\\\\d]*$";
// 문자만 허용;
String REGEXP_PATTERN_CHAR = "^[\\\\w]*$";
if (Pattern.matches(REGEXP_PATTERN_NUMBER, Character.toString(name.charAt(0)))) return false;
if (Pattern.matches(REGEXP_PATTERN_CHAR, name)) return true;
else return false;
}