๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Algorithm ๐Ÿง‘๐Ÿป‍๐Ÿ’ป/๋ฐฑ์ค€(BOJ)

[๋ฐฑ์ค€,c++] 10174๋ฒˆ - ํŒฐ๋ฆฐ๋“œ๋กฌ

by dkswnkk 2021. 10. 16.
 

10174๋ฒˆ: ํŒฐ๋ฆฐ๋“œ๋กฌ

ํŒฐ๋ฆฐ๋“œ๋กฌ์€ ์•ž์œผ๋กœ ์ฝ์œผ๋‚˜ ๋’ค๋กœ ์ฝ์œผ๋‚˜ ๋˜‘๊ฐ™์€ ๋‹จ์–ด๋‚˜ ์ˆซ์ž๋“ค์„ ๋งํ•œ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ๋Œ€์†Œ๋ฌธ์ž๋ฅผ ๊ตฌ๋ถ„ํ•˜์ง€ ์•Š์ง€๋งŒ, ๊ณต๋ฐฑ์€ ๊ตฌ๋ถ„ํ•œ๋‹ค. ๋‹ค์Œ์€ ํŒฐ๋ฆฐ๋“œ๋กฌ์˜ ์˜ˆ์‹œ์ด๋‹ค. Anna Harrah Arora Nat tan 9998999 123

www.acmicpc.net

 

//  Copyright © 2021 ์•ˆ์ฃผํ˜•. All rights reserved.
//  
//  https://www.acmicpc.net/problem/10174
//  BOJ10174 ํŒฐ๋ฆฐ๋“œ๋กฌ
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int N; cin >> N;
    cin.ignore();
    while (N--) {
        string s; 
        getline(cin, s);
        transform(s.begin(), s.end(), s.begin(), ::tolower);
        int start = 0;
        int end = s.length() - 1;
        bool flag = true;
        while (start <= end) {
            if (s[start] != s[end]) flag = false;
            start++;
            end--;
        }
        if (flag) cout << "Yes"<<"\n";
        else cout << "No"<<"\n";
    }
}

๋Œ“๊ธ€