Let $S=\{1,2, \ldots ,10^{10}\}$. Find all functions $f:S \rightarrow S$, such that $$f(x+1)=f(f(x))+1 \pmod {10^{10}}$$ for each $x \in S$ (assume $f(10^{10}+1)=f(1)$).
To find all functions \( f: S \rightarrow S \) such that \( f(x+1) = f(f(x)) + 1 \pmod{10^{10}} \) for each \( x \in S \) and \( f(10^{10}+1) = f(1) \), we will proceed step-by-step.

1. **Initial Conditions and Function Iteration:**
   Given the functional equation:
   \[
   f(x+1) = f(f(x)) + 1 \pmod{10^{10}}
   \]
   Let's start by examining the first few values:
   \[
   f(2) = f(f(1)) + 1
   \]
   \[
   f(3) = f(f(2)) + 1 = f(f(f(1)) + 1) + 1
   \]
   \[
   f(4) = f(f(3)) + 1 = f(f(f(f(1)) + 1) + 1) + 1
   \]
   Continuing this pattern, we see that each \( f(x) \) is defined recursively in terms of \( f(1) \).

2. **General Form:**
   We observe that:
   \[
   f(n) = f(f(f(\ldots f(f(1)) + 1 \ldots) + 1) + 1) + 1
   \]
   where the function \( f \) is applied \( n-1 \) times.

3. **Cycle and Modulo Condition:**
   Since \( f \) maps \( S \) to itself and \( S \) is finite, \( f \) must eventually repeat values, forming a cycle. Given the modulo condition \( \pmod{10^{10}} \), we need to find a function that satisfies the periodicity and the given functional equation.

4. **Assumption and Verification:**
   Assume \( f(x) = x + k \pmod{10^{10}} \) for some integer \( k \). We need to verify if this form satisfies the functional equation:
   \[
   f(x+1) = (x+1) + k \pmod{10^{10}}
   \]
   \[
   f(f(x)) = f(x + k) = (x + k) + k \pmod{10^{10}} = x + 2k \pmod{10^{10}}
   \]
   Substituting into the functional equation:
   \[
   (x + 1) + k \equiv (x + 2k) + 1 \pmod{10^{10}}
   \]
   Simplifying, we get:
   \[
   x + 1 + k \equiv x + 2k + 1 \pmod{10^{10}}
   \]
   \[
   k \equiv 2k \pmod{10^{10}}
   \]
   This implies:
   \[
   k \equiv 0 \pmod{10^{10}}
   \]
   Therefore, \( k = 0 \) is the only solution that satisfies the functional equation.

5. **Conclusion:**
   The only function that satisfies the given conditions is:
   \[
   f(x) = x \pmod{10^{10}}
   \]

The final answer is \( \boxed{ f(x) = x \pmod{10^{10}} } \)