Please solve the programming task below using a self-contained code snippet in a markdown code block.

You are given a digit string s that consists of digits from 0 to 9.
A string is called semi-repetitive if there is at most one adjacent pair of the same digit. For example, "0010", "002020", "0123", "2002", and "54944" are semi-repetitive while the following are not: "00101022" (adjacent same digit pairs are 00 and 22), and "1101234883" (adjacent same digit pairs are 11 and 88).
Return the length of the longest semi-repetitive substring of s.
 
Please complete the following python code precisely:
```python
class Solution:
    def longestSemiRepetitiveSubstring(self, s: str) -> int:
```