O(n) solution using frequency Counter
Complexity

Time complexity: O(n)


Space complexity: O(n)

Code
# Complexity
- Time complexity: $$O(n)$$

- Space complexity: $$O(n)$$

# Code
```python3 []
class Solution:
    def numOfPairs(self, nums: List[str], target: str) -> int:
        freq = Counter(nums)
        pairs = 0

        for string, frequency in freq.items():
            if target.startswith(string):
                second_part = target[len(string):]      # suffix of the current string
                pairs += frequency * freq[second_part]

                # Remove count of self pairs
                if string == second_part:
                    pairs -= freq[second_part]
        
        return pairs
```
['Array', 'Hash Table', 'String', 'Counting', 'Python3']