[백준 2908] 상수 (C++/Python)
C++) #include #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string a, b; cin >> a >> b; reverse(a.begin(), a.end()); reverse(b.begin(), b.end()); cout
C++) #include #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string a, b; cin >> a >> b; reverse(a.begin(), a.end()); reverse(b.begin(), b.end()); cout
C++) #include #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); bool arr[26]; int ans = 0; int t; cin >> t; while (t--) { string str; cin >> str; char past = '\0'; bool flag = false; fill(arr, arr + 26, false); for (auto ch : str) { if (!arr[ch - 'a'] && past != ch) { arr[ch - 'a'] = true; past = ch; } else if (arr[ch - 'a'] && past != ch..
C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string a, b, c, d; cin >> a >> b >> c >> d; cout
#include #include using namespace std; int arr[27]; int main(void){ string s; cin >> s; for(int i=0; i
C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string str; getline(cin, str); string ans = ""; for (auto ch : str) { if (!isalpha(ch)) { ans += ch; continue; } if (islower(ch)) ans += (ch - 'a' + 13) % 26 + 'a'; else ans += (ch - 'A' + 13) % 26 + 'A'; } cout
C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string str; cin >> str; cout
C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, temp; cin >> n; int op[2] = { 0,0 }; for (int i = 0; i > temp; op[temp] ++; } if (op[1] > op[0]) cout
C++) #include #include #include #include using namespace std; bool compare(pair m1, pair m2) { if (m1.second == m2.second) return m1.first > m2.first; else return m1.second > m2.second; } int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string str; cin >> str; // 대문자로 변환 transform(str.begin(), str.end(), str.begin(), ::toupper); vector v; for (char ch = 'A'; ch
C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while (t--) { int n; string temp; cin >> n >> temp; for (auto ch : temp) { for (int i = 0; i < n; i++) cout
C++) #include #include using namespace std; int main(void) { ios_base::sync_with_stdio(false); cin.tie(nullptr); string str; getline(cin, str); int ans = 0; bool flag = false; for (auto ch : str) { if (isalpha(ch)) { flag = true; } // 공백임 else { if (flag) { ans += 1; flag = false; } } } if (flag) ans += 1; cout