← 返回 snowflake 的题目列表Check Validity of Input String
类型:online_judge
Write a function to check if a given string is valid. The string consists of lowercase letters and dots. Dots must be separated by at least one letter, and cannot start or end with consecutive dots. For example, given the string "aa.bb.cc", it should return True; given "..cc", it should return False.
Input
A string str consisting of lowercase English letters and dots.
Output
A boolean indicating whether the string is valid.
Examples
Input: "aa.bb.cc"
Output: True
Input: "aa..cc"
Output: True
Input: ".bb.cc"
Output: False
Input: "..cc"
Output: False
Constraints
The length of the string does not exceed 100 characters.
Example
Input
aa.bb.cc