[Java] Easy 100% solution
java\nclass Solution {\n    public int numOfPairs(final String[] nums, final String target) {\n        final Map<String, Integer> map = new HashMap<>();\n      
```java\nclass Solution {\n    public int numOfPairs(final String[] nums, final String target) {\n        final Map<String, Integer> map = new HashMap<>();\n        int count = 0;\n\n        for(int i = 0; i < nums.length; ++i) {\n            if(target.startsWith(nums[i])) {\n                final int startIdx = nums[i].length();\n                final String end = target.substring(startIdx);\n\n                if(map.containsKey(end))\n                    count += map.get(end);\n            }\n\n            if(target.endsWith(nums[i])) {\n                final int endIdx = target.length() - nums[i].length();\n                final String start = target.substring(0, endIdx);\n\n                if(map.containsKey(start))\n                    count += map.get(start);\n            }\n\n            map.put(nums[i], map.getOrDefault(nums[i], 0) + 1);\n        }\n\n        return count;\n    }\n}\n```
['Java']