public class MyClass {
static boolean contain_only_three_same_repeating_chars(String s) {
int len = s.length();
if (len % 3 != 0) return false;
for (int i = 0; i < len - 3; i++) {
if (s.charAt(i) != s.charAt(i + 3)) {
return false;
}
}
return true;
}
public static void main(String args[]) {
String s = "xyzxyzxyz";
if (contain_only_three_same_repeating_chars(s))
System.out.print( "Yes");
else
System.out.print("No");
}
}
/*
run:
Yes
*/