import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter stdout = new PrintWriter(System.out);

        String dna;
        while ((dna = stdin.readLine()) != null && dna.length() != 0) {
            String pattern = stdin.readLine();
            char[] t = dna.toCharArray(), p = pattern.toCharArray();
            int i = 0, j = 0, next[] = getNext(pattern);
            while (i < t.length && j < p.length) {
                if (j == -1 || t[i] == p[j]) {
                    i++;
                    j++;
                } else {
                    j = next[j];
                }
            }

            if (j == p.length) {
                stdout.println("Resistente");
            } else {
                stdout.println("Nao resistente");
            }
        }
        stdout.close();
    }

    private static int[] getNext(String pattern) {
        char[] p = pattern.toCharArray();
        int j = 0, k = -1, next[] = new int[p.length];
        next[0] = -1;
        while (j < p.length - 1) {
            if (k == -1 || p[j] == p[k]) {
                j++;
                k++;
                next[j] = k;
            } else {
                k = next[k];
            }
        }
        return next;
    }
}

@@ -1320,62 +1320,146 @@
     
-j++;%0A                k++;%0A                next%5Bj%5D = k;
+if (p%5B++j%5D == p%5B++k%5D) %7B%0A                    next%5Bj%5D = next%5Bk%5D;%0A                %7D else %7B%0A                    next%5Bj%5D = k;%0A                %7D
 %0A   

update KMP getNext() method