Simple Solution
Complexity
Time complexity: O(N^2)

Space complexity: O(N)
Code


# Complexity
- Time complexity: O(N^2)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(N)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public boolean hasSameDigits(String s) {
        StringBuilder str = new StringBuilder(s);
        while(str.length()>2){
            StringBuilder t = new StringBuilder();
            for(int i = 0;i<str.length()-1;i++){
                    int f = str.charAt(i)-'0';
                    int sec = str.charAt(i+1)-'0';
                    t.append((char)((f+sec)%10 +'0'));
            }
            // System.out.println(t.toString());
            str = t;
        }
        return str.charAt(0)==str.charAt(1);
    }
}
```
['Java']