import java.util.ArrayList;
public class StringChecker {
static String SYMBOLS = "~!@#$%^&*()_+{}|<>?,./";
static List symbolSubstrings = splitStringIntoSubstrings(SYMBOLS, 3);
public static boolean containsRepeatingOrIncrementalChars(String str) {
int length = str.length();
int[] asciiArray = convertToAsciiArray(str);
for (int i = 0; i < asciiArray.length; i++) {
if (i >= asciiArray.length - 2) {
int current = asciiArray[i];
int next = asciiArray[i + 1];
int afterNext = asciiArray[i + 2];
if ((next == current + 1 && afterNext == next + 1) || (current == next && next == afterNext)) {
for (String symbol : symbolSubstrings) {
if (str.contains(symbol)) {
public static List splitStringIntoSubstrings(String str, int substringLength) {
List substrings = new ArrayList<>();
for (int i = 0; i < str.length(); i++) {
if (i + substringLength > str.length()) {
int endIndex = Math.min(i + substringLength, str.length());
String substring = str.substring(i, endIndex);
substrings.add(substring);
public static int[] convertToAsciiArray(String str) {
int[] asciiArray = new int[str.length()];
for (int i = 0; i < str.length(); i++) {
asciiArray[i] = (int) str.charAt(i);
public static void main(String[] args) {
System.out.println(containsRepeatingOrIncrementalChars("abc3132132"));
System.out.println(containsRepeatingOrIncrementalChars("123fasfadfas"));
System.out.println(containsRepeatingOrIncrementalChars("!@#dfafa"));
System.out.println(containsRepeatingOrIncrementalChars("aabc"));
System.out.println(containsRepeatingOrIncrementalChars("fas12@##"));