Security problem

Report a typo

Here's a situation: you are an information security officer. You must inspect employees' work station records. First, you need to check files with suspicious file names. Basically, these are file names containing any words like: secret, pass, or stash.

You get a file name. If it contains a suspicious word, you need to print out the message reject, otherwise print accept.

Sample Input 1:

passwords.txt

Sample Output 1:

reject
Write a program in Go
package main

import (
"fmt"
"regexp"
)

func main() {
rePass := regexp.MustCompile(`.*pass.*`)
reSecret := regexp.MustCompile(?)
reStash := regexp.?(?)

var filename string

fmt.Scan(&filename)

if rePass.MatchString(filename) || reSecret.MatchString(?) || ?.MatchString(?) {
fmt.Println("reject")
} else {
fmt.Println(?)
}
}
___

Create a free account to access the full topic