https://www.acmicpc.net/problem/11478
#include <bits/stdc++.h>
#include <unordered_map>
#define endl "\n"
using namespace std;
void CPP_INIT() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main(void) {
CPP_INIT();
string str;
int n, m, size;
unordered_map<string, int> um;
cin >> str;
for (int i = 0; i < str.size(); i++) {
for (int j = i; j < str.size(); j++) {
um[str.substr(i, j - i + 1)]++;
}
}
cout << um.size();
}
'Algorithm > 백준' 카테고리의 다른 글
C++ 알고리즘 - 백준 1735 분수 합 (0) | 2025.01.11 |
---|---|
C++ 알고리즘 - 백준 1934 최소공배수 (0) | 2025.01.11 |
C++ 알고리즘 - 백준 1269 대칭 차집합 (0) | 2025.01.11 |
C++ 알고리즘 - 백준 7785 회사에 있는 사람 (0) | 2025.01.11 |
C++ 알고리즘 - 백준 14425 문자열 집합 (0) | 2025.01.11 |