From 0d5e3d5ffe9f3306a5233d62813a4fe41ec6e691 Mon Sep 17 00:00:00 2001 From: Rhinemann Date: Mon, 8 May 2023 10:51:54 +0300 Subject: [PATCH] Slight rehash. --- Java/lab_3/lab_3.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Java/lab_3/lab_3.java b/Java/lab_3/lab_3.java index 85dff8d..e048b29 100644 --- a/Java/lab_3/lab_3.java +++ b/Java/lab_3/lab_3.java @@ -41,8 +41,8 @@ public class lab_3 { public static String compareStrings(StringBuilder builder) { for (int leftBoundary = 0; leftBoundary <= builder.length(); leftBoundary++) { for (int rightBoundary = builder.length(); leftBoundary >= 0; rightBoundary--) { - if (result.equals(builder.substring(leftBoundary, rightBoundary).toString().toLowerCase().replaceAll("[^a-z]",""))) { - return builder.substring(leftBoundary, rightBoundary).toString(); + if (result.equals(builder.substring(leftBoundary, rightBoundary).toLowerCase().replaceAll("[^a-z]",""))) { + return builder.substring(leftBoundary, rightBoundary); } } }