Java clean solution
\n# Code\n\nclass Solution {\n    public int numOfPairs(String[] nums, String target) {\n        Map<String, Integer> strings = new HashMap<String, Integer>();\
\n# Code\n```\nclass Solution {\n    public int numOfPairs(String[] nums, String target) {\n        Map<String, Integer> strings = new HashMap<String, Integer>();\n        int t = target.length();\n        int res = 0;\n        for(String num : nums){\n            int n = num.length();\n            if(target.startsWith(num)){\n                res+=strings.getOrDefault(target.substring(num.length()), 0);\n            }\n            if(target.endsWith(num)){\n                res+=strings.getOrDefault(target.substring(0,t-n), 0);\n            }\n            strings.put(num, strings.getOrDefault(num, 0) + 1);\n        }\n        return res;\n    }\n}\n\n```
['Hash Table', 'Java']