查找——小易喜欢的单词
发布日期:2021-05-14 23:49:24 浏览次数:23 分类:精选文章

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

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

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

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

  • ������������������������������
  • ������������������������������������
  • ������������������������������������������������"xyxy"���"THETXH"������������������
  • ���������������������������������������������

    #include 
    #include
    using namespace std;
    bool checkCondition(const string &s) {
    // ���������������������������������������
    for (char c : s) {
    if (c >= 'a' && c <= 'z') {
    return true;
    }
    }
    // ������������������������������������������������
    for (int i = 1; i < s.size(); ++i) {
    if (s[i] == s[i-1]) {
    return true;
    }
    }
    // ������������������������������������������������
    int len = s.size();
    for (int i = 0; i < len - 3; ++i) {
    for (int j = i+1; j < len - 2; ++j) {
    for (int k = j+1; k < len - 1; ++k) {
    if (s[i] == s[k] && s[j] == s[k+1]) {
    return true;
    }
    }
    }
    }
    return false;
    }
    int main() {
    string s;
    cout << "���������������������";
    cin >> s;
    if (!checkCondition(s)) {
    cout << "Likes" << endl;
    } else {
    cout << "Dislikes" << endl;
    }
    }

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

    ��� Python ���������������������������������������������������������������������������������������������������������������

    import re
    def check_string(word):
    # ������������������
    if re.search(r'[a-z]', word):
    return True
    # ������������������������
    if re.search(r'(..)\1', word):
    return True
    # ������������������������
    if re.search(r'([A-Z])(.*?)(\1).*?\2', word):
    return True
    return False
    word = input('���������������������')
    if check_string(word):
    print("Dislikes")
    else:
    print("Likes")

    ������

    ���������������������������������������������������������������������������������������������������������������"Likes"���"Dislikes"���������������������������������������������������������

    上一篇:软件测试理论 软件测试的目的、定义、原则
    下一篇:64.最小路径和

    发表评论

    最新留言

    网站不错 人气很旺了 加油
    [***.192.178.218]2025年04月24日 19时42分50秒