import java.util.*;
import java.lang.*;
class Main
{
{
String regex
= "^[\u0400-\u04FFa-zA-Z ]+(,[\u0400-\u04FFa-zA-Z ]+)*$";
System.
out.
println("abc,xyz,pqr".
matches(regex
)); // true System.
out.
println("text1,text2,".
matches(regex
)); // false System.
out.
println("ЕЖЗ,ИЙК".
matches(regex
)); // true }
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CgpjbGFzcyBNYWluCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewogICAgICAgIFN0cmluZyByZWdleCA9ICJeW1x1MDQwMC1cdTA0RkZhLXpBLVogXSsoLFtcdTA0MDAtXHUwNEZGYS16QS1aIF0rKSokIjsKICAgICAgICAKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oImFiYyx4eXoscHFyIi5tYXRjaGVzKHJlZ2V4KSk7IC8vIHRydWUKICAgIAlTeXN0ZW0ub3V0LnByaW50bG4oInRleHQxLHRleHQyLCIubWF0Y2hlcyhyZWdleCkpOyAvLyBmYWxzZQogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigi0JXQltCXLNCY0JnQmiIubWF0Y2hlcyhyZWdleCkpOyAvLyB0cnVlCgl9Cn0=