Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[S3] 11478 서로 다른 부분 문자열의 개수 #132

Merged
merged 1 commit into from
Dec 20, 2024
Merged

Conversation

wwan13
Copy link
Owner

@wwan13 wwan13 commented Dec 20, 2024

Problem Info

Code

package boj11478;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;

public class Main {

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

    public static void main(String[] args) {
        String input = readLine();
        Set<String> set = new HashSet<>();

        for (int i = 0; i < input.length(); i++) {
            for (int j = i + 1; j <= input.length(); j++) {
                set.add(input.substring(i, j));
            }
        }

        System.out.println(set.size());
    }

    private static String readLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Note

@github-actions github-actions bot added data_structures 알고리즘: data_structures hash_set 알고리즘: hash_set string 알고리즘: string tree_set 알고리즘: tree_set labels Dec 20, 2024
@github-actions github-actions bot changed the title solve : 11478 서로 다른 부분 문자열의 개수 [S3] 11478 서로 다른 부분 문자열의 개수 Dec 20, 2024
@wwan13 wwan13 merged commit 38b3dcd into main Dec 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data_structures 알고리즘: data_structures hash_set 알고리즘: hash_set string 알고리즘: string tree_set 알고리즘: tree_set
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant