牛客网---统计回文
发布日期:2021-05-10 10:38:55 浏览次数:17 分类:精选文章

本文共 1848 字,大约阅读时间需要 6 分钟。

���������������

������������������������������������������������������2���������������1���������������������������������������������������������������������

  • ������������������������������1���������������������������������������������������������������������������������������������������������������������������1���������������������������������������������������������������������������

  • ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

  • ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

  • ���������������������������������������������������������������������������������������������������������������������

    ������������������������

    import namespace std;

    bool isCircle(const string &s) { size_t start = 0, end = s.size() - 1; while (start <= end) { if (s[start] != s[end]) { return false; } ++start; --end; } return true; }

    int main() { string str1, str2; getline(cin, str1); getline(cin, str2); int count = 0; for (int i = 0; i <= str1.size(); ++i) { string s = str1; // ��������������������������������������� s.insert(i, str2); if (isCircle(s)) { count++; } } cout << count << endl;

    return 0;

    }

    ���������������������

  • ������������������������������������������isCircle������������������������������������������
  • ���������������������������������������������������������������������������������������������
  • ������������������������������������������������������������������������������������������
  • ������������������������������������������������������
  • ���������������������������������������������������������������������������������������

    上一篇:剑指offer---连续最大和
    下一篇:牛客网---组队竞赛

    发表评论

    最新留言

    表示我来过!
    [***.240.166.169]2025年04月11日 00时53分29秒