solution.java 446 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
public class Demo2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        sc.close();
        Set<String> set = new HashSet<String>();
        for (int i = 0; i < str.length() + 1; i++) {
            for (int j = i + 1; j < str.length() + 1; j++) {
                set.add(str.substring(i, j));
            }
        }
        System.out.println(set.size());
    }

}