#include <iostream>\n#include <cstring>\n\n\nusing namespace std;\n\nint este_litera(char c) {\n  if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))\n    return 1;\n  return 0;\n}\n\nint este_vocala(char x){\n      if(x=='a' || x=='i' || x=='e' || x=='o' || x=='u' || x=='A' || x=='I' || x=='E' || x=='O' || x=='U')\n      return 1;\n    return 0;\n}\n\nchar batman[300];\n  char line[300];\n\nint main(){\n  int k;\n  int am_cuvant=0;\n  int numar_vocale=0;\n  int numar_litere=0;\n  cin>>k;\n  \n  cin.getline(line, 300);\n\nwhile(!cin.eof()) {\n  cin.getline(line, 300);\n  strcat(batman,line);\n  strcat(batman, " ");\n}\n\n  int c= strlen(batman);\n\n  for(int i=0;i<=c;i++)batman[i];\n\nfor (int i = 0; i < c; ++i) {\n\n  if (este_litera(batman[i])){\n    am_cuvant = 1;\n    ++numar_litere;\n\n    if (este_vocala(batman[i]))\n      ++numar_vocale;\n  }\n  else if (am_cuvant == 1) {\n    if(numar_vocale>=k){\n      for(int j=i-numar_litere;j<i;j++)\n      cout<<batman[j];\n      cout<<"\\n";\n\n    }\n    numar_vocale=0;\n    am_cuvant = 0;\n    numar_litere=0;\n\n  }\n}\n\n\n    return 0;\n}
#include <iostream>\n#include <string>\n#include <cassert>\nusing namespace std;\n\nvoid checkCuv(string s) {\n    assert(0 < s.size() && s.size() <= 100);\n    for (auto c : s)\n        assert(isalpha(c));\n}\n\nint main() {\n    int n; cin >> n;\n    assert(1 <= n && n <= 50);\n    string first; cin >> first;\n    checkCuv(first);\n    int r = 0;\n    for (int i = 1; i <= n; ++i) {\n        string asd; cin >> asd;\n        checkCuv(asd);\n        if (asd.find(first) == 0 && asd.size() > first.size())\n            ++r;\n    }\n    cout << r;\n}
#include <bits/stdc++.h>\n\nusing namespace std;\n\n// The next line will be replaced with the user's code\n#include <cassert>\nvoid intersectie3( int A[] , int B[] , int C[]) {\n    assert(0 <= A[0] && A[0] <= 1000000);\n    assert(0 <= B[0] && B[0] <= 1000000);\n    for (int i = 2; i <= A[0]; ++i)\n        assert(A[i - 1] <= A[i]);\n    for (int i = 2; i <= B[0]; ++i)\n        assert(B[i - 1] <= B[i]);\n    for (int i = 1; i <= A[0]; ++i)\n        assert(0 <= A[i] && A[i] < 1000000000);\n    for (int i = 1; i <= B[0]; ++i)\n        assert(0 <= B[i] && B[i] < 1000000000);\n    for (int i = 1, j = 1; i <= A[0] && j <= B[0];) {\n        if (A[i] == B[j]) {\n            C[++C[0]] = A[i];\n            ++i; ++j;\n        } else if (A[i] < B[j])\n            ++i;\n        else\n            ++j;\n    }\n}\n\nconst int NMAX = 1e6 + 5;\nint a[NMAX] , b[NMAX] , c[2 * NMAX];\nint main()\n{\n    cin >> a[0];\n    for(int i = 1; i <= a[0]; i++)\n        cin >> a[i];\n\n    cin >> b[0];\n    for(int i = 1; i <= b[0]; i++)\n        cin >> b[i];\n    intersectie3(a , b , c);\n    for(int i = 0; i <= c[0]; i++)\n        cout << c[i] << " ";\n    return 0;\n}\n
#include <iostream>\n#include <cassert>\nusing namespace std;\n\nint main() {\n    int x, lastx, lastm = 0, read = 0;\n    while(1) {\n        cin >> x;\n        ++read;\n        assert(0 <= x && x <= 10000);\n        if (!x) \n            break;\n        if (x > lastx && lastm == 1) {\n            cout << "nemonoton";\n            return 0;\n        } else if (x < lastx && lastm == -1) {\n            cout << "nemonoton";\n            return 0;\n        }\n        if (read > 1 && lastx < x) lastm = -1;\n        else if (read > 1 && lastx > x) lastm = 1;\n        \n        lastx = x;\n    }\n    assert(read <= 1000);\n    if (lastm == 1)\n        cout << "descrescator";\n    else if (lastm == -1)\n        cout << "crescator";\n    else\n        cout << "nemonoton";\n}
#include <iostream>\n#include <cassert>\nusing namespace std;\n\nint v[1000];\n\nint main() {\n    int n; cin >> n;\n    assert(3 <= n && n <= 1000);\n    for (int i = 0; i < n; ++i) {\n        cin >> v[i];\n        assert(0 <= v[i] && v[i] <= 1000000);\n    }\n    int np = 0, eg = 0;\n    for (int i = 2; i + 1 < n; ++i) {\n        eg |= v[i] == v[i - 1];\n        np += (v[i - 1] < v[i] && v[i] > v[i + 1]);\n    }\n    eg |= v[n - 2] == v[n - 1];\n    if (eg == 0 && np == 1) cout << 1;\n    else cout << 0;\n}
#include <cstdio>\n#include <cctype>\n#include <iostream>\n#define DN 20\nusing namespace std;\nint n,m,c[DN];\n \nchar sir[100];\nint fol[26];\n\nint isv(char c) {\n\tc = tolower(c);\n\treturn c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';\n}\n\nvoid gen(int p) {\n\tif (p == n) {\n\t\tcout<<sir<<'\\n';\n\t\treturn;\n\t}\n\tfor (char i = 'a'; i < 'a' + n; ++i)\n\t\tif(p==0 || (isv(sir[p-1]) + isv(i) < 2 && !fol[i-'a'])) {\n\t\t\tfol[i-'a'] = 1;\n\t\t\tsir[p] = i;\n\t\t\tgen(p+1);\n\t\t\tfol[i-'a'] = 0;\n\t\t}\n}\n \nint main()\n{\n    //freopen("input.txt","r",stdin);\n    //freopen("output.txt","w",stdout);\n    scanf("%d",&n);\n    gen(0);\n    return 0;\n}
#include <iostream>\n#include <cassert>\nusing namespace std;\n\nint main() {\n    int n;\n    cin >> n;\n    assert(0 <= n && n <= 1000);\n    int v[1000];\n    for (int i = 0; i < n; ++i) {\n        cin >> v[i];\n        assert(-100000 <= v[i] && v[i] <= 100000);\n    }\n    int x, ok = 0;\n    for (int i = 1; i < n && !ok; ++i) {\n        cin >> x;\n        assert(-100000 <= v[i] && v[i] <= 100000);\n        if (x != v[i - 1]) {\n            cout << v[i - 1];\n            ok = 1;\n        }\n    }\n    if (!ok)\n        cout << v[n - 1];\n}
#include <iostream>\n#include <cassert>\n#include <queue>\nusing namespace std;\n\nint main() {\n    int n, m;\n    cin >> n >> m;\n    assert(1 <= n && n <= 900000);\n    assert(1 <= m && m <= 400000);\n    queue<int> c;\n    for (int i = 1; i <= n; ++i) {\n        int x; cin >> x;\n        assert(0 <= x && x <= 10000);\n        c.push(x);\n    }\n    for (int i = 1; i <= m; ++i) {\n        int op; cin >> op;\n        assert(op == 1 || op == 2);\n        if (op == 1 && !c.empty())\n            c.pop();\n        else {\n            int x; cin >> x;\n            assert(0 <= x && x <= 10000);\n            c.push(x);\n        }\n    }\n    cout << c.size() << "\\n";\n    while (c.size()) {\n        cout << c.front() << " ";\n        c.pop();\n    }\n}
#include <iostream>\n#include <cstdio>\n#include <cassert>\nusing namespace std;\n\nint main() {\n//   freopen("input.txt", "r", stdin);\n//   freopen("otput.txt", "w", stdout);\n  int n, m;\n  cin >> n >> m;\n  if (m == 0) {\n    cout << "Nu s-au pierdut date";\n    return 0;\n  }\n  assert(0 <= n && n <= 100000);\n  assert(0 <= m && m <= n);\n  int v[100000];\n  for (int i = 0; i < n; ++i) {\n    cin >> v[i];\n    assert(-100000 <= v[i] && v[i] <= 100000);\n  }\n  int printed = 0, j = 0;\n  for (int i = 0; i < n - m; ++i, ++j) {\n    int x;\n    cin >> x;\n    assert(-100000 <= x && x <= 100000);\n    while(v[j] != x) {\n      cout << v[j] << " ";\n      ++printed;\n      ++j;\n    }\n  }\n  while(j < n) {\n    cout << v[j] << " ";\n    ++printed;\n    ++j;\n  }\n  assert(printed == m);\n}
#include <iostream>\n#include <string>\n#include <cassert>\nusing namespace std;\n\nint main() {\n    string input, line;\n    getline(cin, input);\n    assert(1 <= input.size() && input.size() <= 1000);\n    assert(input.find("} ") == string::npos);\n    int numSpaces = 0;\n    for (auto c:input)\n        if (c == '{') {\n            line += '{';\n            numSpaces += 2;\n            assert(line.size() <= 100);\n            cout << line << "\\n";\n            line = "";\n            for (int i = 1; i <= numSpaces; ++i)\n                line += ".";\n        } else if (c == '}') {\n            if (line.back() != '.')\n                cout << line << "\\n";\n            numSpaces -= 2;\n            assert(numSpaces >= 0);\n            line = "";\n            for (int i = 1; i <= numSpaces; ++i)\n                line += ".";\n            cout << line << "}\\n";\n        } else\n            line += c;\n    if (line.size())\n    \tcout << line;\n    //cout << line;\n}
#include <bits/stdc++.h>\nusing namespace std;\n\n// The next line will be replaced with the user's code\nvoid inserareMedie(int N, int M, double mt[51][51], int k) {\n\tfor (int i = N; i>k; --i)\n\t\tfor (int j = 0; j < M; ++j)\n\t\t\tmt[i][j] = mt[i-1][j];\n\tfor (int j = 0; j < M; ++j) {\n\t\tdouble me = 0;\n\t\tfor (int i = 0; i <= N; ++i) if(i!=k)\n\t\t\tme+=mt[i][j];\n\t\tmt[k][j]=me/N;\n\t}\n}\n\nint main() {\n  int N,M,k;\n  double mt[51][51];\n  cin>>N>>M;\n  for(int i = 0; i<N; ++i)\n    for(int j = 0; j<M; ++j)\n        cin>>mt[i][j];\n  cin>>k;\n  inserareMedie(N, M, mt, k);\n  for (int i = 0; i<=N; ++i) {\n      for(int j = 0; j<M; ++j)\n        cout<<fixed<<setprecision(2)<<mt[i][j]<<' ';\n      cout<<'\\n';\n  }\n  return 0;\n}\n\n
#include <cstring>\n#include <cctype>\n#include <iostream>\n#include <string>\n#define LM 250\nusing namespace std;\n\nint k;\nchar s[LM+1];\nstring tot;\n\nint isv(char c) {\n\tc = tolower(c);\n\treturn c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';\n}\n\nint main() {\n  //freopen("input.txt","r",stdin);\n  cin>>k; cin.get();\n  \n  while (!cin.eof()) {\n  \tcin.getline(s,LM);\n  \tint lg = strlen(s);\n  \tint lgc = 0, nv = 0;\n  \tfor (int i = 0; i < lg; ++i) {\n      tot += s[i];\n  \t  if (isalpha(s[i])) {\n  \t  \t++lgc;\n  \t  \tif (isv(s[i])) ++nv;\n  \t  }\n  \t  else {\n  \t  \tif(lgc && nv >= k) {\n  \t  \t\tfor(int j = i - lgc; j < i; ++j) cout<<s[j];\n  \t  \t\tcout<<'\\n';\n\n  \t  \t}\n  \t  \tlgc = nv = 0;\n  \t  }\n  \t}\n  \tif(lgc && nv >= k) {\n  \t\tfor(int j = lg - lgc; j < lg; ++j) cout<<s[j];\n  \t\tcout<<'\\n';\n  \t}\n  }\n  //cout<<tot.size();\n}
#include <cstdio>\n#include <cctype>\n#include <iostream>\n#define DN 20\nusing namespace std;\nint n,m,c[DN];\n \nchar sir[100];\nint fol[26];\n\nint isv(char c) {\n\tc = tolower(c);\n\treturn c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u';\n}\n\nvoid gen(int p) {\n\tif (p == n) {\n\t\tfor(int i=1; i<n; ++i) if(isv(sir[i-1]) + isv(sir[i]) > 1)\n\t\t\treturn;\n\t\tcout<<sir<<'\\n';\n\t\treturn;\n\t}\n\tfor (char i = 'a'; i < 'a' + n; ++i)\n\t\tif(!fol[i-'a']) {\n\t\t\tfol[i-'a'] = 1;\n\t\t\tsir[p] = i;\n\t\t\tgen(p+1);\n\t\t\tfol[i-'a'] = 0;\n\t\t}\n}\n \nint main()\n{\n    //freopen("input.txt","r",stdin);\n    //freopen("output.txt","w",stdout);\n    scanf("%d",&n);\n    gen(0);\n    return 0;\n}
#include <iostream>\n#include <fstream>\n\nusing namespace std;\n\n\nconst int NMAX = 50 + 5;\nint n;\nint a[NMAX][NMAX];\n\nvoid read()\n{\n    cin >> n;\n    for (int i = 1; i <= n; ++i)\n        for (int j = 1; j <= n; ++j)\n            cin >> a[i][j];\n}\n\nint main()\n{\n    bool h = 0;\n\n    read();\n\n    for (int y = 1; y <= n; ++y, h ^= 1)\n    {\n        int i = 1, j = y;\n        while (j > 0)\n        {\n            if (h) cout << a[i][j] << " ";\n            else cout << a[j][i] << " ";\n            ++i;\n            --j;\n        }\n    }\n\n    for (int y = 2; y <= n; ++y, h ^= 1)\n    {\n        int i = y, j = n;\n        while (i <= n)\n        {\n            if (h) cout << a[i][j] << " ";\n            else cout << a[j][i] << " ";\n            ++i;\n            --j;\n        }\n    }\n\n    return 0;\n}
#include <iostream>\n#include <iomanip>\n#include <algorithm>\n#include <cstring>\n#include <cstdio>\n#include <cassert>\n#define DN 55\nusing namespace std;\n\nint f1[26],f2[26],lg;\nchar cv[1000005];\n\nvoid makef(int f[26]) {\n\tmemset(f, 0, sizeof(f1));\n\tcin>>cv;\n\tlg = strlen(cv);\n\tfor (int i = 0; i < lg; ++i) {\n\t\t// if(!isalpha(cv[i])) {\n\t\t// \tcout<<cv[i]<<'\\n';\n\t\t// \texit(0);\n\t\t// }\n\t\t++f[cv[i]-'a'];\n\t}\n}\n\nint eq(int a[], int b[]) {\n\tint r = 1;\n\tfor (int i = 0; i < 26; ++i)\n\t\tr&=(a[i]==b[i]);\n\treturn r;\n}\n\nint main() {\n  //freopen("4.in","r",stdin);\n  //freopen("4.ok","w",stdout);\n  int N, r=0; cin>>N;\n  makef(f1);\n  while (N--) {\n  \tmakef(f2);\n  \tr+=eq(f1, f2);\n  }\n  cout<<(int)r;\n  return 0;\n}\n\n
#include <bits/stdc++.h>\nusing namespace std;\n\n// The next line will be replaced with the user's code\nint isVoc(char c) {\n  if (!isalpha(c))\n    return 0;\n  c = tolower(c);\n  return c=='a' || c =='e' || c == 'i' || c == 'o' || c == 'u';\n}\n\n\nvoid addChars(char s[]) {\n  int lg = strlen(s);\n  for (int i = lg-1; i >= 0; --i)\n    if(isVoc(s[i])) {\n      for(int j=lg; j>i; --j) s[j] = s[j-1];\n      s[i+1] = '$';\n      ++lg;\n      s[lg] = 0;\n    }\n\n}\n\nint main() {\n  char s[300];\n  cin>>s;\n  addChars(s);\n  cout<<s;\n  return 0;\n}\n\n
#include <iostream>\n#include <cstring>\n#include <cstdio>\n#include <cctype>\n#include <cmath>\n#define DL 100001\nusing namespace std;\n\nchar s[DL+5],cc[DL+5];\nint n,r;\n\nint main() {\n  //freopen("input.txt", "r", stdin);\n  //freopen("output.txt","w", stdout);\n  while(cin.getline(s, DL)) {\n    int lg = strlen(s), lgc=0;\n    for (int i = 0; i < lg; ++i)\n      if(!isalpha(s[i])) {\n        if(lgc) {\n          for(int i = ceil(lgc/2.0); i<lgc; ++i) cout<<cc[i];\n          if(lgc&1) cout<<cc[lgc/2];\n          for(int i = 0; i < lgc/2; ++i) cout<<cc[i];\n          lgc=0;\n        }\n        cout<<s[i];\n      }else cc[lgc++]=s[i];\n    if (lgc) {\n      for(int i = ceil(lgc/2.0); i<lgc; ++i) cout<<cc[i];\n      if(lgc&1) cout<<cc[lgc/2];\n      for(int i = 0; i < lgc/2; ++i) cout<<cc[i];\n      lgc=0;\n    }\n    if(!cin.eof()) cout<<'\\n';\n  }\n  return 0;\n}
#include <bits/stdc++.h>\nusing namespace std;\n\n// The next line will be replaced with the user's code\nint inv(int N) {\n  int in=0;\n  while(N) {\n    in = in*10+N%10;\n    N/=10;\n  }\n  return in;\n}\n\nint ePalindrom(int a) {\n  return a==inv(a);\n}\n\nint nrPal(int a, int b) {\n  int r = 0;\n  for(int i = a; i <= b; ++i) {\n    //cout<<i<<' '<<ePalindrom(i)<<' '<<r<<'\\n';\n    r+=ePalindrom(i);\n  }\n  return r;\n}\n\nint main() {\n  int invers, palindrom, a, b;\n  cin>>invers>>palindrom>>a>>b;\n  cout<<inv(invers)<<'\\n'<<ePalindrom(palindrom)<<'\\n'<<nrPal(a,b);\n  return 0;\n}\n\n
#include <bits/stdc++.h>\nusing namespace std;\n\n// The next line will be replaced with the user's code\nvoid cifre_unice(int x, int y, int &a,int &b)\n{\n    int r1=0,r2=0,sc=0;\n    int F[10];\n    for(int i=x;i<=y;i++)\n    {\n        int ci=i;\n        for(int j=0;j<10;j++)\n            F[j]=0;\n        int dist=1,s=0;\n        while(ci)\n        {\n            F[ci%10]++;\n            if(F[ci%10]==2)\n                dist=0;\n            s+=ci%10;\n            ci/=10;\n        }\n        if(dist)\n        {\n            r1++;\n            if(s>sc)\n                sc=s,r2=i;\n        }\n    }\n    a=r1,b=r2;\n}\n\nint main() {\n\n    int a,b,x,y;\n    cin>>a>>b;\n    cifre_unice(a,b,x,y);\n    cout<<x<<" "<<y;\n  return 0;\n}\n\n
#include <bits/stdc++.h>\nusing namespace std;\n\n// The next line will be replaced with the user's code\nvoid cifre_unice(int a, int b, int &x, int &y){\n    long z,k=0,s=0;\n    int frec[11];\n    long minim=-1;\n    bool ok;\n    for (long i=a;i<=b;i++){\n        z=i;s=0;\n        for (int j=0;j<=9;j++)\n            frec[j]=0;\n        ok=true;\n        while (z>0){\n            frec[z%10]++;\n            s+=z%10;\n            z=z/10;\n        }\n        for (int j=0;j<=9;j++)\n            if (frec[j]>1)\n                ok=false;\n        if (ok==true){\n            k++;\n            if (s>minim){\n                minim=s;\n                y=i;\n        }\n    }\n    x=k;\n}\n}\n\nint main() {\n\n    int a,b,x,y;\n    cin>>a>>b;\n    cifre_unice(a,b,x,y);\n    cout<<x<<" "<<y;\n  return 0;\n}\n\n
#include <iostream>\n#include <cctype>\n#include <cassert>\nusing namespace std;\n\nvoid replace(string c1, string c2, string &t) {\n    size_t pos = 0;\n    while ((pos = t.find(c1, pos)) != string::npos) {\n        if ((pos == 0 || !isalpha(t[pos - 1])) &&\n    \t\t(pos + c1.size() == t.size() || !isalpha(t[pos + c1.size()])))\n            t = t.substr(0, pos) + c2 + t.substr(pos + c1.size());\n        ++pos;\n    }\n}\n\nint main() {\n    int n;\n    cin >> n;\n    string a[10000], b[10000], t;\n    for (int i = 0; i < n; ++i) {\n        cin >> a[i] >> b[i];\n        assert(0 < a[i].size() && a[i].size() <= 20);\n        assert(0 < b[i].size() && b[i].size() <= 20);\n    }\n    getline(cin, t);\n    getline(cin, t);\n    \n    assert(0 < t.size() && t.size() <= 1000);\n    for (int i = 0; i < n; ++i) {\n        replace (a[i], b[i], t);\n    }\n    cout << t;\n}
#include <iostream>\n#include <vector>\n#include <string>\n#include <cassert>\nusing namespace std;\n\nvector<string> sol;\n\nint main() {\n    int l; \n    cin >> l;\n    assert(1 <= l && l <= 170);\n    string line, word, out;\n    getline(cin, line);\n    getline(cin, line);\n    assert(line.size() && line.size() <= 1000);\n    while(line.size()) {\n    \t//cout << line << "\\n";\n        if (line.size() <= l) {\n            sol.push_back(line);\n            line = "";\n        } else {\n            int pos = l - 1;\n            while (pos >= 0 && isalpha(line[pos]) && isalpha(line[pos + 1]))\n                --pos;\n            assert(pos >= 0);\n            sol.push_back(line.substr(0, pos + 1));\n            line = line.substr(pos + 1);\n        }\n    }\n    cout << sol.size() << "\\n";\n    for (int i = 0; i + 1 < sol.size(); ++i) {\n        cout << sol[i] << "\\n-------\\n";\n    }\n    cout << sol.back();\n}
#include <iostream>\n#include <string>\n#include <vector>\n#include <algorithm>\n#include <cassert>\n#include <cstdio>\nusing namespace std;\n\nvector<string> sol;\n\nint main() {\n    int n;\n    cin >> n;\n    assert(1 <= n && n <= 1000);\n    sol.resize(n);\n    getline(cin, sol[0]);\n    for (int i = 0; i < n; ++i) {\n        getline(cin, sol[i]);\n        assert(sol[i].size() == 16);\n        int year, month, day, hours, min;\n        sscanf(sol[i].c_str(), "%d:%d:%d %d:%d", &year, &month, &day, &hours, &min);\n        assert (1899 <= year && year <= 2019);\n        assert(1 <= month && month <= 12);\n        assert(1 <= day && day <= 31);\n        assert(0 <= hours && hours <= 23);\n        assert(0 <= min && min <= 59);\n    }\n    sort(sol.begin(), sol.end());\n    for (auto s : sol)\n        cout << s << "\\n";\n}
