Slight rehash.

This commit is contained in:
Rhinemann 2023-05-08 10:51:54 +03:00
parent fd8c37c7cb
commit 0d5e3d5ffe
1 changed files with 2 additions and 2 deletions

View File

@ -41,8 +41,8 @@ public class lab_3 {
public static String compareStrings(StringBuilder builder) { public static String compareStrings(StringBuilder builder) {
for (int leftBoundary = 0; leftBoundary <= builder.length(); leftBoundary++) { for (int leftBoundary = 0; leftBoundary <= builder.length(); leftBoundary++) {
for (int rightBoundary = builder.length(); leftBoundary >= 0; rightBoundary--) { for (int rightBoundary = builder.length(); leftBoundary >= 0; rightBoundary--) {
if (result.equals(builder.substring(leftBoundary, rightBoundary).toString().toLowerCase().replaceAll("[^a-z]",""))) { if (result.equals(builder.substring(leftBoundary, rightBoundary).toLowerCase().replaceAll("[^a-z]",""))) {
return builder.substring(leftBoundary, rightBoundary).toString(); return builder.substring(leftBoundary, rightBoundary);
} }
} }
} }