Advertisement
knyazer

Untitled

Apr 21st, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import java.util.HashSet;
  2. import java.util.Scanner;
  3. import java.util.Set;
  4.  
  5.  
  6. public class Main {
  7. public static void main(String[] args) {
  8. Scanner in = new Scanner(System.in);
  9.  
  10. String s = in.next();
  11. Set<String> set = new HashSet<String>();
  12. int l = s.length();
  13.  
  14. for (int i = 0; i < l; i++) {
  15. for (int j = i + 1; j < l; j++) {
  16. for (int k = j + 1; k < l; k++) {
  17. String c = "";
  18. char s1 = s.charAt(i), s2 = s.charAt(j), s3 = s.charAt(k);
  19. if (s1 == '0') continue;
  20. c += s1;
  21. c += s2;
  22. c += s3;
  23. set.add(c);
  24. }
  25. }
  26. }
  27.  
  28. System.out.println(set.size());
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement