#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int NMAX = 100000;
char s1[NMAX+1], s2[NMAX+1];

int main(int, char *argv[]) {
  int k = atoi(argv[1]);
  cin >> s1; int l1 = strlen(s1);
  cin >> s2; int l2 = strlen(s2);
  cout << l1 << " " << l2 << endl;
  //проверяем правильность
  if (strncmp(s1+l1-k,s2,k)==0) cout << "OK\n"; else cout << "Error\n";
  return 0;
}