We are asked to find the number of ternary strings of length 5 that contain at least one occurrence of two consecutive symbols, specifically "aa", "bb", or "cc".
1. Total number of strings in \( S \):
The total number of ternary strings of length 5 is:
\[
3^5 = 243
\]
because each position in the string can be filled with any of the three symbols \( a \), \( b \), or \( c \).
2. Strings without consecutive symbols:
Next, we need to subtract the number of strings that do not contain any consecutive identical symbols. If the string does not contain consecutive identical symbols, we have the following choices:
- The first character can be any of \( a \), \( b \), or \( c \).
- The second character must be different from the first.
- The third character must be different from the second, and so on.
So, the number of such strings is:
\[
3 \times 2 \times 2 \times 2 \times 2 = 3 \times 2^4 = 48
\]
because the first character has 3 choices, and each subsequent character has 2 choices (to avoid repeating the previous character).
3. Strings with at least one pair of consecutive identical symbols:
The number of strings that contain at least one occurrence of two consecutive symbols is the complement of the number of strings without consecutive symbols. Thus, the number of strings with at least one consecutive pair is:
\[
243 - 48 = 195
\]
Thus, the number of such strings of length 5 is \( \boxed{195} \).