fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner scan = new Scanner(System.in);
  13. scan.forEachRemaining(a -> {
  14. a.chars().forEach(ch -> {
  15. sb.append(sb.length() % 4 == 3 ? "-" : "");
  16. sb.append(Character.isDigit(ch) ? (char)ch:"");
  17. });
  18. System.out.println(sb);
  19. });
  20. scan.close();
  21. }
  22. }
Success #stdin #stdout 0.24s 321472KB
stdin
123123wqw13a13(*^*5754
123123123
5666666661223sfd1123
stdout
123-123-131-357-54
123-123-123
566-666-666-122-311-23