Simple Swift Solution
Code
![Screenshot 2025-03-25 at 12.50.26 PM.png](https://assets.leetcode.com/users/images/5a3b2471-038c-44c8-b01d-f5f8ca154089_1742896242.9352245.png)


# Code
```swift []
class Solution {
    func hasSameDigits(_ s: String) -> Bool {
        var digits = s.compactMap(\.wholeNumberValue)
        while digits.count > 2 {
            digits = digitsSum(digits)
        }
        return digits[0] == digits[1]
    }
    private func digitsSum(_ digits: [Int]) -> [Int] {
        var result = [Int]()
        for i in 0..<digits.count - 1 {
            result.append((digits[i] + digits[i + 1]) % 10)
        }
        return result
    }
}
```
['Swift']