+ import std.math; import std.typecons; - import std.math; /* Create a function which takes a string representing a file's name, and returns - 'Yes' if the the file's name is valid, and returns 'No' otherwise. ? ---- + 'Yes' if the the file's name is valid, and returns 'No' otherwise. - A file's name is considered to be valid if and only if all the following conditions ? ---- + A file's name is considered to be valid if and only if all the following conditions - are met: ? ---- + are met: - - There should not be more than three digits ('0'-'9') in the file's name. ? ---- + - There should not be more than three digits ('0'-'9') in the file's name. - - The file's name contains exactly one dot '.' ? ---- + - The file's name contains exactly one dot '.' - - The substring before the dot should not be empty, and it starts with a letter from ? ---- + - The substring before the dot should not be empty, and it starts with a letter from - the latin alphapet ('a'-'z' and 'A'-'Z'). ? ---- + the latin alphapet ('a'-'z' and 'A'-'Z'). - - The substring after the dot should be one of these: ['txt', 'exe', 'dll'] ? ---- + - The substring after the dot should be one of these: ['txt', 'exe', 'dll'] - Examples: ? ---- + Examples: - >>> file_name_check("example.txt") ? ---- + >>> file_name_check("example.txt") - "Yes" + "Yes" - >>> file_name_check("1example.dll") ? ---- + >>> file_name_check("1example.dll") + "No" - "No" - */ string file_name_check(string file_name)