/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String s
= "[2017-08-17 08:00:00 Comming in [Contact:NO] [REF:] [REF2:] [REF3:] [Name:+AA] [Fam:aa] [TEMP:-2:0:-2:0:-2] [Resident:9:free] [end:0:]"; Pattern pat = Pattern.compile("^\\[*(\\d[\\d: -]+\\d).*?\\[Name:([^]]*)].*?\\[Fam:(\\w*)].*?\\[Resident:\\w*:([^]]*)]");
Matcher matcher = pat.matcher(s);
if (matcher.find()){
System.
out.
println("Date: " + matcher.
group(1)); System.
out.
println("Name: " + matcher.
group(2)); System.
out.
println("Fam: " + matcher.
group(3)); System.
out.
println("Resident: " + matcher.
group(4)); }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwucmVnZXguKjsKLyogTmFtZSBvZiB0aGUgY2xhc3MgaGFzIHRvIGJlICJNYWluIiBvbmx5IGlmIHRoZSBjbGFzcyBpcyBwdWJsaWMuICovCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQkKCQlTdHJpbmcgcyA9ICJbMjAxNy0wOC0xNyAwODowMDowMCBDb21taW5nIGluIFtDb250YWN0Ok5PXSBbUkVGOl0gW1JFRjI6XSBbUkVGMzpdIFtOYW1lOitBQV0gW0ZhbTphYV0gW1RFTVA6LTI6MDotMjowOi0yXSBbUmVzaWRlbnQ6OTpmcmVlXSBbZW5kOjA6XSI7CgkJUGF0dGVybiBwYXQgPSBQYXR0ZXJuLmNvbXBpbGUoIl5cXFsqKFxcZFtc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