print(“””foo”bar”””) Why is this legal in Python?
I tested in Python print(“””foo”bar”””) and do not get an Error like i would expect. But I don’t understand why the result is foo“bar
Find the longest substring with k repeated elements
The problem is to find the longest substring with k repeated elements, however k is the number of repeated elements e.g. if we have the string “ababcbb” and k=1, then the retrieved longest substrings are “babc” and “abcc” because in the first instance “b” is the repeated element and in the second instance “c” is the repeated element. If k is two,the longest substring is “babccb”, because “b” is repeated three times and “c” is repeated twice, that’s what it’s meant by “k is the number of repeated elements”. In the final program, the string has to be read from a file.