Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashSet;
- import java.util.Scanner;
- import java.util.Set;
- public class Main {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- String s = in.next();
- Set<String> set = new HashSet<String>();
- int l = s.length();
- for (int i = 0; i < l; i++) {
- for (int j = i + 1; j < l; j++) {
- for (int k = j + 1; k < l; k++) {
- String c = "";
- char s1 = s.charAt(i), s2 = s.charAt(j), s3 = s.charAt(k);
- if (s1 == '0') continue;
- c += s1;
- c += s2;
- c += s3;
- set.add(c);
- }
- }
- }
- System.out.println(set.size());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement