Advertisement
MonsterScripter

CodinGame_2023_09_05__18_40_10__phone_number.cpp

Sep 5th, 2023
806
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.73 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. /**
  4.  * 01 Test 1
  5.  * Entrée
  6.  * Sortie attendue
  7.  * 1234567890
  8.  * (123) 456-7890
  9.  *
  10.  * 02 Test 2
  11.  * Entrée
  12.  * Sortie attendue
  13.  * 1111111111
  14.  * (111) 111-1111
  15.  *
  16.  * 03 Test 3
  17.  * Entrée
  18.  * Sortie attendue
  19.  * 1211111111
  20.  * (121) 111-1111
  21.  *
  22.  * 04 Test 4
  23.  * Entrée
  24.  * Sortie attendue
  25.  * 9999999999
  26.  * (999) 999-9999
  27.  */
  28. class Solution {
  29.  
  30.     public static void main(String args[]) {
  31.         Scanner in = new Scanner(System.in);
  32.         String S = in.nextLine();
  33.        
  34.         // Formatage du numéro de téléphone
  35.         System.out.println("("
  36.             + S.substring(0, 3) + ") "
  37.             + S.substring(3, 6) + "-"
  38.             + S.substring(6, 10)
  39.         );
  40.     }
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement