+ 2
Detect repetition in strings
I have a list of strings: abckdgsos hdksabcjso uddsgsabc oshdoabcj etc. In each set of strings there are only a certain substring that is repeated. In this case it is "abc". I tried making a for loop that would go through every character of every string, but it takes too long to complete the task. It is basically a nested loop inside a nested loop. Any suggestions or help will be greatly appreciated.
7 Réponses
+ 6
yeah as u can see that i have replaced a string of single character with that of "" (null value).....
you can replace the similar string (here "abc") with that of null ("")........
+ 5
see my code which removes similar characters from two strings
https://code.sololearn.com/cR2pDR3jNNau/?ref=app
its in java.....
+ 4
line 22 and 23
+ 4
use this
String a = "abckdgsos";
a=a.replace("abc","");
+ 1
Hmm It's a good concept, but do you think we can do something similar with strings instead of characters? @chirag ghosh
+ 1
At which line are you referring to?
+ 1
Hmm. My problem is that the code should detect the repetition in strings, without any string coded in the program.
I'll go play a bit with your code and see if I can figure something out.