#include <cctype>
#include <string>
class Solution {
  public:
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     *
     * @param s string字符串
     * @return bool布尔型
     */
    bool isPalindromeNickname(string s) {
        // write code here
        int ls = s.size();
        string ans = "";
        for (int i = 0; i < ls; ++i) {
            if (s[i] >= 'A' && s[i] <= 'Z')
                ans += s[i] + 32;
            if (s[i] >= 'a' && s[i] <= 'z')
                ans += s[i];
            if (isdigit(s[i]))
                ans += s[i];
        }
        //   cout<<ans<<endl;
        int n = ans.size();
        int l = 0, r = n - 1;
        while (l <= r) {
            if (ans[l] != ans[r]) {
                return false;
            }
            l++;
            r--;
        }
        return true;
    }
};

一、题目考察的知识点

模拟

二、题目解答方法的文字分析

先把大写转小写,然后出去多余的字符,最后两头遍历就行

三、本题解析所用的编程语言

c++