@@ -0,0 +1,946 @@
+/**%0A * %0A */%0Apackage hackerRank;%0A%0A/**%0A * @author Arun.G%0A * %0A */%0Aimport java.util.Scanner;%0Aimport java.util.regex.*;%0A%0Apublic class SplitthePhoneNumbers %7B%0A%0A%09/**%0A%09 * @param args%0A%09 */%0A%09public static void main(String%5B%5D args) %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09Scanner sc = new Scanner(System.in);%0A%09%09int no = sc.nextInt();%0A%09%09while (no-- %3E= 0) %7B%0A%09%09%09String word = sc.nextLine();%0A%09%09%09int count = 0;%0A%09%09%09String result = %22%22;%0A%09%09%09if (!word.equals(%22%22)) %7B%0A%09%09%09%09// for country%0A%09%09%09%09String pattern = %22(%5B0-9%5D%7B1,%7D)%5B -%5D%7B1%7D(%5B0-9%5D%7B1,3%7D)%5B -%5D%7B1%7D(%5B0-9%5D%7B4,10%7D)%22;%0A%09%09%09%09Pattern phonePattern = Pattern.compile(pattern);%0A%09%09%09%09Matcher m = phonePattern.matcher(word);%0A%09%09%09%09if (m.matches()) %7B%0A%09%09%09%09%09String countryCode = m.group(1);%0A%09%09%09%09%09String localAreaCode = m.group(2);%0A%09%09%09%09%09String Number = m.group(3);%0A%0A%09%09%09%09%09result = %22CountryCode=%22 + countryCode + %22,LocalAreaCode=%22%0A%09%09%09%09%09%09%09+ localAreaCode + %22,Number=%22 + Number;%0A%09%09%09%09%7D%0A%09%09%09%09System.out.println(result);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09sc.close();%0A%09%7D%0A%0A%7D%0A

Split the Phone Numbers