A website domain such as "discuss.leetcode.com" consists of various subdomains. At the highest level, there is "com", at the next level, there is "leetcode.com", and at the lowest level, there is "discuss.leetcode.com". When a domain such as "discuss.leetcode.com" is visited, each of its parent subdomains, "leetcode.com" and "com", is visited implicitly as well.
A count pair domain is a string formatted as "rep d1.d2.d3" or "rep d1.d2", where rep specifies the number of visits to that domain, and the remainder represents the domain itself.
Given an array of count pair domain strings cpdomains, return an array of the count pair domains representing each subdomain visited in the input. The result may be returned in any order.
Constraints:
cpdomain.length
cpdomain[i].length
cpdomain[i] follows either the "rep_i d1_i.d2_i.d3_i" format or the "rep_i d1_i.d2_i" format.
rep_i is an integer in the range
d1_i, d2_i, and d3_i consist of lowercase English letters.
A website domain such as "discuss.leetcode.com" consists of various subdomains. At the highest level, there is "com", at the next level, there is "leetcode.com", and at the lowest level, there is "discuss.leetcode.com". When a domain such as "discuss.leetcode.com" is visited, each of its parent subdomains, "leetcode.com" and "com", is visited implicitly as well.
A count pair domain is a string formatted as "rep d1.d2.d3" or "rep d1.d2", where rep specifies the number of visits to that domain, and the remainder represents the domain itself.
Given an array of count pair domain strings cpdomains, return an array of the count pair domains representing each subdomain visited in the input. The result may be returned in any order.
Constraints:
cpdomain.length
cpdomain[i].length
cpdomain[i] follows either the "rep_i d1_i.d2_i.d3_i" format or the "rep_i d1_i.d2_i" format.
rep_i is an integer in the range
d1_i, d2_i, and d3_i consist of lowercase English letters.