Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
vowels = set('aeiou') def suf(s, k): global vowels i = 0 l_s = len(s) - 1 while l_s >= 0: if s[l_s] in vowels: i += 1 if i == k: return s[l_s:] l_s -= 1 print "NO" exit(0) r = raw_input n,k = map(int,r().strip().split(' ')) w_s = 7 p_s = [suf(r().s...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import re import sys rgx = re.compile( '[aeiou]' ) rs = { 63:'aaaa', 33:'aabb', 18:'abab', 12: 'abba' } pairs = { 1: [0,1], 2:[0,2], 4:[0,3], 8:[1,2], 16:[1,3], 32:[2,3] } def c( qs, k): scheme = 63 for q in qs: splits = [] falls = [] for lin in q: fall= re.findall(rgx,lin) if len(fall) < ...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) throws IOException { Scanner sc = new Scanner(System.in); PrintWriter pr = new PrintWriter(System.out); int n = sc.nextInt(); int k = sc.nextInt(); boolean gb = true; ...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k, cntk; string s[10009]; string sf, rh[2], rh1, common; bool check(string ss) { if (ss != "aabb" && ss != "abab" && ss != "abba" && ss != "aaaa") return false; return true; } bool vowel(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k, aaaa, abab, aabb, abba, flag1, v; string s[5], s1[5]; int main() { cin >> n >> k; aabb = 1; abab = 1; abba = 1; aaaa = 1; flag1 = 1; for (int q = 1; q <= n; q++) { for (int i = 1; i <= 4; i++) cin >> s[i]; if (flag1 == 0) continue; for (i...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class C { private static String ans (List<String> words, int k) { List<String> suffixes = new ArrayList<String>(); for (String word: words) { String suf = word.replace('a', '*').replace('e', '*...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; bool syll[256]; void nope() { cout << "NO" << endl; exit(0); } int main() { syll['a'] = syll['e'] = syll['i'] = syll['o'] = syll['u'] = true; int n, k; cin >> n >> k; set<string> res; for (int i = 0; i < n; i++) { string suf[4]; for (int j = 0; j < 4; ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
n,k = map(int,input().split()) lis=[] vov=['a','e','i','o','u'] d={} d['aabb']=d['abab']=d['abba']=d['aaaa']=0 for i in range(n*4): s = input() lis.append(s) if i%4==3: tmp=['']*4 for j in range(4): s=lis[j] c=0 cou=0 for ll in s[::-1]: ...
PYTHON3
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.*; import java.io.*; import java.awt.Point; import static java.lang.Math.*; public class P139C { static int n; static int k; public static void main(String[] args) throws Exception { Scanner in = new Scanner(System.in); n = in.nextInt(); k = in.nextInt(); in...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.*; import java.util.*; import java.lang.*; public class Rextester{ static boolean isVowel(char ch){ if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'){ return true; } return false; } static String getRhymeScheme(String[] input,int k){ String[] suffixe...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import sys n, k = map(int, sys.stdin.readline().split()) vowels = 'aiueo' def a4(rh): return rh[0] == rh[1] == rh[2] == rh[3] def abab(rh): return rh[0] == rh[2] and rh[1] == rh[3] def aabb(rh): return rh[0] == rh[1] and rh[2] == rh[3] def abba(rh): return rh[0] == rh[3] and rh[1] == rh[2] ok = [True] *...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
def suffix(tpl): s, k = tpl for i in range(len(s)): if s[len(s)-i-1] == 'a' or \ s[len(s)-i-1] == 'e' or \ s[len(s)-i-1] == 'i' or \ s[len(s)-i-1] == 'o' or \ s[len(s)-i-1] == 'u' : k -= 1 if k==0: return s[len(s)-i-1:] inp = raw...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k; string line[10101]; vector<int> r; bool isvowel(char c) { return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'); } string extract(string s, int k) { int position = -1; for (int i = s.length(); i > 0; i--) { if (isvowel(s[i - 1])) k--; if ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; template <class T> void chmin(T &t, T f) { if (t > f) t = f; } template <class T> void chmax(T &t, T f) { if (t < f) t = f; } template <typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; } template <typename T> T sqr(T x) { return x * x; } template <typenam...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; bool vowel(char c) { return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'; } int main() { int n, k; scanf("%d %d", &n, &k); bool aabb = 1, abab = 1, abba = 1; vector<string> s(4); while (n--) { for (int i = 0; i < 4; ++i) { cin >> s[i]; ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; const signed long long Infinity = 1000000001; const long double Pi = 2.0L * asinl(1.0L); const long double Epsilon = 0.000000001; template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { return os << "(" << p.first << "," << p.second << ")"; } t...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#!/usr/bin/env python def get_scheme(quarts): if quarts[0] == quarts[1] and quarts[1] == quarts[2] and quarts[2] == quarts[3]: return 'aaaa' if quarts[0] == quarts[1] and quarts[2] == quarts[3]: return 'aabb' if quarts[0] == quarts[2] and quarts[1] == quarts[3]: return 'abab' ...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; const int maxn = 1e4 + 7; char str[maxn]; char ans[4]; int main() { int n, k; cin >> n >> k; int flag = 0; for (int i = 0; i < n; i++) { map<string, int> mp; string s[4]; char tans[4]; tans[0] = 1; int c = 0; for (int j = 0; j < 4; j++) { ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
def IsOk(c): return c in ['a', 'e', 'o', 'i', 'u'] def f(k): a = raw_input() b = raw_input() c = raw_input() d = raw_input() ai = len(a) - 1 bi = len(b) - 1 ci = len(c) - 1 di = len(d) - 1 r = 0 while ai >= 0 and r < k: r += IsOk(a[ai]) ai -= 1 ...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, m; char poem[4][10005]; bool is[4][4]; int len[4]; char ans[5][10] = {"aaaa", "aabb", "abab", "abba", "NO"}; int vol(char x) { if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') return true; return false; } int type[2505]; int main(int argc, char** arg...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 25000; int n, m, maxn; char s[10][N], r[4][N]; int a[N]; int main() { scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) { for (int j = 1; j <= 4; j++) { scanf("%s", s[j]); int len = strlen(s[j]), cur = m, k; for (k = len - 1; k >= 0;...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k, sp = -1; scanf("%d%d\n", &n, &k); vector<string> v; for (int i = 0; i < n; i++) { v.clear(); int a; for (int j = 0; j < 4; j++) { string s; getline(cin, s); int b = k, pos = -1; for (int z = s.size() - 1; z ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
def rhyme(a,b,k): v=["a","e","i","o","u"] i_a=None i_b=None v_a=0 v_b=0 for i in range(len(a)-1,-1,-1): if a[i] in v: v_a+=1 if v_a==k: i_a=i break for i in range(len(b)-1,-1,-1): if b[i] in v: v_b+=1 if v_b==k: i_b=i break if i_a!=None and i_b...
PYTHON3
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int find(string str, char vowel[], int k) { int count = 0; for (int i = str.size() - 1; i >= 0; i--) { char found = '0'; for (int j = 0; j < 5; j++) if (str[i] == vowel[j]) { found = vowel[j]; break; } if (found != '0') { co...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
//package codeforces; /** * * @author Siddharth */ import java.io.*; public class Lesson { static boolean vowel(char x) { if(x=='a'||x=='e'||x=='i'||x=='o'||x=='u')return true; return false; } public static void main(String args[]) throws IOException { BufferedReader br=new Buff...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.awt.Point; import java.io.*; import java.math.BigInteger; import java.util.*; import static java.lang.Math.*; public class C { final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE")!=null; BufferedReader in; PrintWriter out; StringTokenizer tok = new Strin...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
def vowel(x): if x in list("aeiou"): return 1 return 0 aaaa,aabb,abab,abba=1,1,1,1 n,k=map(int,raw_input().split()) for i in range(n): temp=[] for j in range(4): vowels=0 x = raw_input() x=x[::-1] for it in range(len(x)): if vowel(x[it]): ...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import sun.reflect.generics.tree.Tree; import java.io.*; import java.util.*; public class A2 { static Scanner in; static int next() throws Exception {return in.nextInt();}; // static StreamTokenizer in; static int next() throws Exception {in.nextToken(); return (int) in.nval;} // static BufferedReader in; static Pr...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
n, k = map(int, input().split()) ve = 'aeiou' abba, aabb, abab = 1, 1, 1 for j in range(n): a = ['']*4 for i in range(4): a[i] = input() l = len(a[i]) curr = 0 while l > 0 and curr < k: l -= 1 if a[i][l] in ve: curr += 1 ...
PYTHON3
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class C { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] S = in.readLine().split(" "); int n =...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; public class problemC implements Runnable{ boolean[] vowels=new boolean[256]; { vowels['a']=true; vowels['e']=true; vowels['i']=true...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#!/usr/bin/python VOWELS = ['a', 'e', 'o', 'u', 'i'] def solve(): n, k = map(int,raw_input().split()) poem = [] for i in xrange(4*n): s = raw_input().strip() i = len(s) for j in xrange(k): i -= 1 while i >= 0 and s[i] not in VOWELS: i -= 1 if i < 0: return "NO" poem.append(s[i:]) #print ...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k; string s[10010]; bool rifm(string s, string t) { int j = s.length() - 1, l = t.length() - 1, kol = 0; while (s[j] == t[l]) { if (s[j] == 'a' || s[j] == 'e' || s[j] == 'i' || s[j] == 'o' || s[j] == 'u') kol++; if (kol == k) return true; j--; ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.StreamTokenizer; import java.util.TreeSet; public class Main { private static char[] gl = {'a', 'e', 'i', 'o', 'u'}; private sta...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k, res[4]; char s[10001]; vector<string> v, p; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < n; ++i) for (int j = 0; j < 4; ++j) { scanf("%s", s); v.push_back(s); } bool can = true; for (int i = 0; i < n; ++i) { p.clear(); ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
vowel = ['a','e','i','o','u'] def aabb(pv): if pv[0]==pv[1] and pv[2]==pv[3]: return True else: return False def abab(pv): if pv[0]==pv[2] and pv[1]==pv[3]: return True else: return False def abba(pv): if pv[0]==pv[3] and pv[2]==pv[1]: return True else: ...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
vowels = ['a', 'e', 'i', 'o', 'u'] def rhyme(a, b, k): ai = -1 c = 0 if (a[ai] in vowels): c += 1 while (c < k) and (abs(ai) < len(a)): ai -= 1 if (a[ai] in vowels): c += 1 if (c < k): return False bi = -1 c = 0 if (b[bi] in vowels): c += 1 while (c < k) and (abs(bi) < len(b)): bi -= 1 if (b...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int q, k, now, p; cin >> q >> k; string vowels[4], line; int scheme = 0; bool possible = true; for (int i = 0; i < q; i++) { now = 0; for (int j = 0; j < 4; j++) { cin >> line; vowels[j] = ""; for (p = line.length() - 1; p ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.StringTokenizer; public class cf138a { public static void main(String[] args) { ...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.*; import java.math.*; import java.util.*; public class Solution { public static final String INPUT_FILE = "a.in"; public static final String OUTPUT_FILE = "a.out"; BufferedReader bf; StringTokenizer st; public String next() throws IOException { if (st == null || !st.hasMo...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.*; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String line = scan.nextLine(); int n = Integer.parseInt(line.substring(0, line.indexOf(' '))); int k = Integer.parseInt(line.substring(line.indexOf(' ') + 1)); int[] type = new...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.*; import java.lang.*; import java.math.*; import java.io.*; import static java.lang.Math.*; import static java.util.Arrays.*; // Literature Lesson // 2011/12/24 public class P138A{ Scanner sc=new Scanner(System.in); int n, k; String[] ss; void run(){ n=sc.nextInt(); k=sc.nextInt(); sc.ne...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Arrays; import java.util.StringTokenizer; public class C139 { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = null; String nextTo...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k; int rhymes[2550]; string arr[4]; int vowel(char a) { return (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u'); } int rhyme(string a, string b) { int cnt = 0; int i; for ((i) = 0; (i) < (int)(((int)(a).size())); (i)++) if (vowel(a[i])) cnt++; ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.Arrays; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class c99 { public static void debug(Object... obs) { System.out.println(Arrays.deepToString(obs)); } final static String[]vow={"a", "e", "i", "o", "u" }; final static Set<String>...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringTokenizer; public class Main { boolean isVowel(char c) { return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'; } String suffix(String s, int k) { for (int ...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.*; import java.util.*; import java.math.*; public class c { String _token() throws IOException { while (in.ready() && !st.hasMoreTokens()) { st = new StringTokenizer(in.readLine()); } if (st.hasMoreTokens()) return st.nextToken(); return ""; ...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class TAskC { public static Set<Character> vowels; public static int n; public static int ...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.*; public class c { public static void main(String[] args) { HashMap<String,Integer> HM = new HashMap<String,Integer>(); Scanner sc = new Scanner(System.in); String input = sc.nextLine(); Scanner temp = new Scanner(input); int Q = temp.nextInt(); int...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; const char vow[5] = {'a', 'e', 'i', 'o', 'u'}; string S[4]; int C[3]; void doMagic() { if (S[0] == S[1] && S[2] == S[3]) C[0]++; if (S[0] == S[2] && S[1] == S[3]) C[1]++; if (S[0] == S[3] && S[1] == S[2]) C[2]++; } int main() { int n, k; cin >> n >> k; for (int ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.Arrays; import java.util.Scanner; import java.util.Vector; public class CF136B { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); String[] poem = new String[4 * n]; int glob = 0; for (int i = 0; i < 4 * n; ++i) { ...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int N, K; string pm[2510][4]; string vol = "aeiou"; int tp[2510]; int bi[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256}; int getSufId(string &s) { int cnt = 0; for (int i = s.size() - 1; i >= 0; --i) { if (vol.find(s[i]) != -1) { ++cnt; if (cnt == K) return i;...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; const string vow = "aeiou"; string line, suf[4], last; int n, k; bool ok; inline int get_suf() { int i, j; for (i = line.size() - 1, j = 0; i >= 0 && j < k; --i) { if (vow.find(line[i]) != string::npos) ++j; } if (j != k) ok = false; return i + 1; } inline str...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
from sys import stdin read = stdin.readline n,k = map(int,read().split()) r = 0 vowel = {'a','e','i','o','u'} def cmp(a,b,k,vowel): l = 0 for x,y in zip(reversed(a),reversed(b)): if x != y: return False l += (x in vowel) if l == k: return True return False ...
PYTHON3
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
vowels = set('aeiou') def suf(s, k): global vowels i = 0 l_s = len(s) - 1 while l_s >= 0: if s[l_s] in vowels: i += 1 if i == k: return s[l_s:] l_s -= 1 print "NO" exit(0) r = raw_input n,k = map(int,r().strip().split(' ')) w_s = 7 p_s = [suf(r().s...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k; string getsuf(const string &s) { int it = 0; for (int i = s.size() - 1; i > -1; i--) { if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u') it++; if (it == k) return s.substr(i); } return "-1"; } int getType(vector<str...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; public class CF139C { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String fstl = br.readLi...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; string S[4] = {"aabb", "abab", "abba", "aaaa"}; string ans[5]; int pipei[2505]; string s[2505][4]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, K; while (cin >> n >> K) { int flag = 0; for (int i = 0; i < n; i++) for (int j = 0; j < 4;...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.*; /** * Created by IntelliJ IDEA. * User: piyushd * Date: 3/26/11 * Time: 10:53 PM * To change this template use File | Settings | File Templates. */ public class TaskC { String vowels = "aeiou"; void run(){ int n = nextInt(), k = nextInt(); String[] suffix...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int oo = (int)1e9; string vw = "aeiou"; int main() { int n, k; scanf("%d%d", &n, &k); n; int flg = 1; int aabb = 1, abab = 1, aaaa = 1, abba = 1; for (int i = 0; i < n; ++i) { string str; vector<string> vs; for (int j = 0; j < 4; ++j) { cin >> ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; public class C { public static void main( final String[] args ) throws IOException { final BufferedReader br = new BufferedReader( new InputStreamReader( System.in ...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; vector<int> T; int n, k; long long p = 31; bool glas(char c) { if (c == 'a' || c == 'o' || c == 'u' || c == 'e' || c == 'i') return true; else return false; } int type_of(string &s1, string &s2, string &s3, string &s4) { long long hash1 = 0, hash2 = 0, hash3 =...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.*; import java.io.*; import java.lang.ref.Reference; import java.math.BigDecimal; import java.math.BigInteger; public class Main { Scanner in; PrintWriter out; public static void main(String[] s) { new Main().run(); } void run() { in = new Scanner(System.in); out = new PrintWriter(System....
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> typedef struct node { char str[10001]; } node; node poem[4]; long n, k; int q[3]; int find_v(char *str, int t) { int i, tmp; tmp = strlen(str); for (i = tmp - 1; i >= 0; i--) { if (str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u') t--; ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; inline double sqr(double x) { return x * x; } #pragma comment(linker, "/STACK:16777216") int k; string lst(string s, int n) { int i = s.size(), ctr = 0; string r, v = "aeiou"; while (i--) { r = s[i] + r; if (v.find(s[i]) != -1) ++ctr; if (ctr == k) return ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.*; public class Main { public static boolean vowel(char ch) { return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'; } public static String doIt(String s, int k) { ...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, ct, pos, k; string s1, s2, s3, s4, resp = "aaaa"; bool enc = 1; scanf("%d%d", &n, &k); for (int i = 0; i < n; ++i) { cin >> s1 >> s2 >> s3 >> s4; ct = 0, pos; for (int i = s1.length() - 1; i >= 0; i--) { if (s1[i] == 'a' || s1...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k, ans_res = -2; bool glas(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return 1; else return 0; } int main() { scanf("%d%d\n", &n, &k); for (int i = 0; i < n; i++) { int res = 0; vector<string> list; for (int j ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; const int M = 10000 + 10; int main() { int n, k; cin >> n >> k; set<int> res; bool flag = true; for (int i = 0; i < n; i++) { string s[4]; for (int j = 0; j < 4; j++) { cin >> s[j]; } string t[4]; for (int j = 0; j < 4; j++) { int l...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.*; import java.io.*; public class C99C{ static BufferedReader br; public static void main(String args[])throws Exception{ br=new BufferedReader(new InputStreamReader(System.in)); int nums[]=toIntArray(); int n=nums[0]; int k=nums[1]; char vow[]={'a','e','...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; string a[10000]; string sep(string s, int k) { string al = "aeiou"; int kol = 0; for (int i = 0; i < s.size(); i++) if (al.find(s[i]) < al.size() && al.find(s[i]) >= 0) kol++; if (kol < k) { cout << "NO"; exit(0); } kol = 0; string res; int j = s...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; bool is_vowel(char ch) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') { return true; } return false; } bool is_rhyme(string s1, string s2, int k) { int i, p1 = 0, p2 = 0, l1, l2; for (i = s1.size() - 1, p1 = 0; i >= 0 && p1 < k; i--) { ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k; string ans = ""; vector<string> v; string func(string s) { int cnt = 0; for (int i = (int)s.size() - 1; i >= 0; i--) if (s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u') { ++cnt; if (cnt == k) return s.substr(i);...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
n, k = map(int, input().split()) vowels = ['a', 'e', 'i', 'o', 'u'] def find_nth(tab, S, n): amount, pos = (1 if tab[0] in S else 0), 0 while pos < len(tab) and amount < n: pos += 1 if tab[pos] in S: amount += 1 return pos def rhyme_type(lines, k): suffixes = [] for l...
PYTHON3
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Hashtable; import java.util.StringTokenizer; public class C139 { public static void main(String[] args) throws Exception { System.out.println(res()); } public static String res() throws Exception { BufferedReader r = new Buffere...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k; int main() { int i, j; cin >> n >> k; bool ac = true; string ans; for (i = 0; i < n; i++) { string ss, s[4], str; str = "a "; for (j = 0; j < 4; j++) { cin >> ss; s[j] = ""; int t = 0; for (int h = ss.length() - 1; h...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<string> s; for (int i = 0; i < 4 * n; i++) { string p; cin >> p; string temp; int count = 0; for (int j = 0; j < p.size(); j++) { if (p[j] == 'a' || p[j] == 'e' || p[j] == 'i' || p[j] == 'o' || ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; int i, j, w, x, y; bool rhyme[4][4], scheme[5000][4]; string str[4]; map<int, string> name; name[0] = "aaaa"; name[1] = "aabb"; name[2] = "abab"; name[3] = "abba"; cin >> n >> k; for (i = 0; i < (n); i++) { for (j = 0; j < (4...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Reader; import java.io.StreamTokenizer; import java.io.Writer; import java.util.Arrays; public class s99_c { public s...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
//import java.io.*; import java.util.*; import java.lang.Math.*; public class poems { public static void main(String args[])throws Exception { Scanner in=new Scanner(System.in); //BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); int n=in.nextInt(),k=in.nextInt...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; const char vow[5] = {'a', 'e', 'i', 'o', 'u'}; string S[4]; int C[4]; void doMagic() { if (S[0] == S[1] && S[1] == S[2] && S[2] == S[3] && S[3] == S[0]) { C[0]++; C[1]++; C[2]++; C[3]++; return; } if (S[0] == S[1] && S[2] == S[3]) { C[1]++; ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<string> words(4 * n); string S; int aabb = 0, abab = 0, abba = 0, aaaa = 0, NO = 0; for (int i = (0); i < (4 * n); ++i) { cin >> S; int size = S.size(); int Kth = 0; string newS = ""; bool canRhyme...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; vector<int> text; int n, k; long long p = 31; bool vowel(char ch) { return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'; } int type_of(string &s1, string &s2, string &s3, string &s4) { long long hash1 = 0, hash2 = 0, hash3 = 0, hash4 = 0; long long cu...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; vector<vector<string> > v; int mat[2509][4]; int vowel(char ch) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') return 1; return 0; } int main() { int n, k; string s; int ans1 = 1, ans2 = 1, ans3 = 1, ans4 = 1; cin >> n >> k; int i; int ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; import java.util.StringTokenizer; public class C implements R...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import sys def vfind(s, k): rs = s[::-1] cnt = 0 for i in xrange(len(rs)): if rs[i] in "aeiou": cnt += 1 if cnt == k: return rs[:i+1][::-1] else: return None n,k = map(int, raw_input().split()) ls = [] for i in xrange(4*n): ls.append(raw_input...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k; string q[4]; bool can[4]; bool okey(char c) { if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') return true; return false; } bool ok(string a, string b) { if ((int)a.length() < k || (int)b.length() < k) return false; int aa = a.length(); int ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.PrintWriter; import java.util.Scanner; import java.util.TreeSet; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); int n = in.nextInt(); int k = in.nextInt(); i...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; map<long long, long long> mp; string s[2504][4]; bool f[4] = {0}; int main() { long long n, m; cin >> n >> m; for (int i = 0; i < n; i++) for (int j = 0; j < 4; j++) cin >> s[i][j]; map<string, int> mp; for (int i = 0; i < n; i++) { mp.clear(); for (in...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k, m; string s[100005]; int is_vol(char c) { string t = "aeiou"; for (int i = 0; i < t.size(); i++) { if (c == t[i]) return 1; } return 0; } int ok(vector<string> v) { if (v.size() == 0) return 1; set<string> v2; for (int i = 0; i < v.size(); i++) {...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.util.Scanner; public class C { static String[]a; static int k; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); k = sc.nextInt(); String[]ss = {"aabb", "abab", "abba", "aaaa"}; a = new String[5]; ...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k, m; string s[100005]; int is_vol(char c) { string t = "aeiou"; for (int i = 0; i < t.size(); i++) { if (c == t[i]) return 1; } return 0; } int ok(vector<string> v) { if (v.size() == 0) return 1; set<string> v2; for (int i = 0; i < v.size(); i++) {...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; const int N = 2500 * 4 + 10; int n, k, d, sz; bool isV[2000], M = 0; string arr[N]; set<string> st[N]; string change(string z) { int c = 0; string s = ""; for (int i = z.size() - 1; i >= 0; i--) { s += z[i]; if (isV[z[i]]) M = 1, c++; if (c == k) break; ...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
VOWELS = ['a', 'e', 'o', 'u', 'i'] def solve(): n, k = map(int,raw_input().split()) poem = [] for i in xrange(4*n): s = raw_input().strip() i = len(s) for j in xrange(k): i -= 1 while i >= 0 and s[i] not in VOWELS: i -= 1 if i < 0...
PYTHON
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int n, k, len, cur, r[2510], size; string s[5], sub[5]; bool ok; bool check(char ch) { if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'u' || ch == 'o') return true; return false; } int rifm(string s1, string s2, string s3, string s4) { if (s1 == s2 && s1 == s3 &...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; const int INFint = 2147483647; const long long INF = 9223372036854775807ll; const long long MOD = 1000000007ll; const long double EPS = 1e-9; string s[4], r[4]; int main() { ios_base::sync_with_stdio(0); map<char, bool> gl; gl['a'] = 1, gl['e'] = 1, gl['i'] = 1, gl['o...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> using namespace std; int mer(vector<int> &v) { int last = 0; for (int i = 0; i < v.size(); i++) { if (v[i] != 0) { if (v[i] == -1) return -1; else if (last == 0) last = v[i]; else if (last != v[i]) return -1; } } return last; } int c(cha...
CPP
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.*; public class C { private void solve() throws IOException { int blocks = nextInt(); int k = nextInt(); boolean ok = true...
JAVA
139_C. Literature Lesson
Vera adores poems. All the poems Vera knows are divided into quatrains (groups of four lines) and in each quatrain some lines contain rhymes. Let's consider that all lines in the poems consist of lowercase Latin letters (without spaces). Letters "a", "e", "i", "o", "u" are considered vowels. Two lines rhyme if their ...
2
9
#include <bits/stdc++.h> int k; int vowel(char c) { return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u'; } int rhyme(char *s, char *t) { int n, m, i, j, cnt; n = strlen(s); m = strlen(t); for (i = n - 1, cnt = 0; i >= 0 && cnt < k; i--) if (vowel(s[i])) cnt++; if (cnt < k) return 0; for (j...
CPP