#P6565. Rescue SOS Signal Analysis
Rescue SOS Signal Analysis
Rescue SOS Signal Analysis
The rescue center receives numerous SOS signals each day. After receiving a signal, the center analyzes it by counting the number of times the substring sos
appears in the signal. Note that occurrences of sos
can overlap, e.g. sosos
contains 2 occurrences because the substrings starting at indices 0
and 2
both form sos
(i.e., it counts as $2$ occurrences).
Your task is to help the rescue center determine the urgency of a given rescue signal by computing the number of times the substring sos
appears. A larger count indicates a more urgent situation.
inputFormat
The input consists of a single line containing a string made up of lowercase English letters.
Constraints: The string length will be at least 1.
outputFormat
Output a single integer that represents the number of times the substring sos
appears in the input string. Overlapping occurrences should be counted.
sample
sos
1