Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

c++ to python 3 converter

#include <bits/stdc++.h>
using namespace std;
bool isSubstring(string s1, string s2)
{
    int n = s1.size();
    int m = s2.size();
    for (int i = 0; i < n - m + 1; i++)
    {
        int j;
        for (j = 0; j < m; j++)
        {
            if (s1[i + j] != s2[j])
                break;
        }
        if (j == m)
            return true;
    }
    return false;
}
int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        string s;
        cin >> s;
        if (isSubstring(s, "101") || isSubstring(s, "010"))
        {
            cout << "Tasty" << endl;
        }
        else
            cout << "Tasteless" << endl;
    }
    return 0;
}
Source by www.daniweb.com #
 
PREVIOUS NEXT
Tagged: #python #converter
ADD COMMENT
Topic
Name
2+7 =