string repeated characters count in java