Damaged SOS Signal
A Mars rover repeatedly sends the same signal, SOS, but some characters may be changed during transmission. The function mars_exploration receives the received string s, whose length is a multiple of 3. Compare it with the expected repeated SOS message and count how many characters are in the wrong positions. Return the number of differences.
Примеры
Ввод
"SOSSPSSQSSOR"Вывод
3Ввод
"SOSSOT"Вывод
1Ввод
"SOS"Вывод
0Нужно реализовать
def mars_exploration(s: str) -> int:
Теги
strings
Melde dich an, um den Einreichungsverlauf zu sehen
AnmeldenMelde dich an, um den KI-Mentor zu nutzen
AnmeldenVisible tests
1
Input
"SOSSPSSQSSOR"Expected
32
Input
"SOSSOT"Expected
13
Input
"SOS"Expected
04
Input
"SOSSOSSOS"Expected
05
Input
"XOSXOS"Expected
26
Input
"sosspssqssor"Expected
12Focus radio
Paused · SomaFM · Fluid