output
stringlengths
52
181k
instruction
stringlengths
296
182k
#include <bits/stdc++.h> using namespace std; bool debug = 0; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; string direc = "RDLU"; long long ln, lk, lm; void etp(bool f = 0) { puts(f ? "YES" : "NO"); exit(0); } void addmod(int &x, int y, int mod = 1000000007) { assert(y >= 0); x += y; if (x >...
### Prompt Your challenge is to write a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; const int MAXN = 450; vector<int> adj[MAXN]; string data[MAXN]; int vis[MAXN]; void dfs(int u) { vis[u] = 1; for (int v : adj[u]) { if (!vis[v]) dfs(v); } } string process(string s) { string tmp = ""; for (int i = 0; i < s.size(); i++) { if (s[i] == 'u') ...
### Prompt Please create a solution in Cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; set<string> st; vector<string> v[n]; vector<string> vv[n]; for (int i = 0; i < n; i++) { string s; cin >> s; v[i].push_back(s); s.clear(); } for (int j = 0; j ...
### Prompt Please formulate a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(0); int n; cin >> n; set<string> s; string x, y; for (int i = 0; i < n; i++) { cin >> x; int z = x.size(); for (int k = 0; k < 800; k++) { y = ""; for (int j = 0; j < x.size(); j++) { ...
### Prompt Your task is to create a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; int fa[405]; char str[405][30]; char str1[30], str2[30]; int solve(int i, int j) { int p1 = 0, p2 = 0, l1 = strlen(str[i]), l2 = strlen(str[j]); strcpy(str1, str[i]); strcpy(str2, str[j]); while (1) { if (p1 == l1 && p2 == l2) return 1; else if (p1 == ...
### Prompt Please formulate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; map<string, int> vi; int main() { int n; cin >> n; string s, s1; while (n--) { cin >> s; s1 = ""; int i = s.size() - 1; while (i >= 0) { if (s[i] != 'h' && s[i] != 'u') { s1 += s[i]; i--; } else if (s[i] == 'u') { ...
### Prompt Construct a CPP code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; const int N = 4e2 + 10; int n; string s[N]; string removeKH(string a) { string res = "", temp = ""; bool found_k = false; for (int i = 0; i < (int)a.size(); ++i) { if (a[i] == 'k') { found_k = true; temp.push_back(a[i]); } else { if (found_k)...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; set<string> st; for (int i = int(0); i < int(n); ++i) { string s; cin >> s; vector<int> to_erase; for (int j = int(s.size() - 1); j >= int(1); --j) { if (s[j] == 'h') { f...
### Prompt Develop a solution in CPP to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; const int maxn = 410; char s[maxn][30]; string ss[maxn]; int getnum(int n) { int cnt = 1; sort(ss, ss + n); for (int i = 1; i < n; i++) { if (ss[i] != ss[i - 1]) cnt++; } return cnt; } int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { ...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; template <class T> inline void smax(T &x, T y) { x = max((x), (y)); } template <class T> inline void smin(T &x, T y) { x = min((x), (y)); } map<string, int> M; string s1, s2; int main() { int i, j, k, l, m, n; cin >> n; int ans = 0; for (k = 1; k <= n; k++) { ...
### Prompt Your task is to create a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; void inp(); int main() { inp(); return 0; } char str[200]; void inp() { set<string> se; string oo("oo"); string u("u"); string kh("kh"); string h("h"); int n; scanf("%d", &n); while (n--) { scanf("%s", str); int p; string s(str); int f = ...
### Prompt Please create a solution in cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int n; char c[1024]; string second, t; set<string> w; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { scanf("%s", c); second = c; bool ok = 1; while (ok) { t = ""; ok = 0; for (int i = 0; i < (int(second.size())); +...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; map<string, int> mp; int main() { int n, ans = 0; cin >> n; string s, s1, s2; while (n--) { cin >> s; s1 = ""; for (int i = 0; i < s.length(); i++) { if (s[i] == 'u') { s1 += "oo"; continue; } if (s[i] == 'h') { ...
### Prompt Your challenge is to write a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; set<string> st; int main() { int n; cin >> n; int i, j; string s[400]; for (i = 0; i < n; i++) { cin >> s[i]; int ct = 0; int tmp; string vec; for (j = 0; j < s[i].size(); j++) { if (s[i][j] == 'u') { vec.push_back('o'); v...
### Prompt Generate a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; int main() { int n; set<string> s; for (cin >> n; n; n--) { string word; cin >> word; while (1) { int len = word.length(); string nword = ""; for (int i = 0; i < len;) { if (i + 1 < len && word[i] == 'o' && word[i + 1] == 'o') { ...
### Prompt Develop a solution in cpp to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { int n, sum = 0; cin >> n; map<string, bool> Map; char s[25], tmp[50]; while (n--) { cin >> s; int l = strlen(s); int index = 0, t = 0; while (index < l) { if (s[index] == 'u') { tmp[t++] = 'o'; tmp[t++] = 'o'; ...
### Prompt In CPP, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; const int siz = 1e5 + 10; const long long modu = 1e9 + 7; int main() { int n; string s; scanf("%d", &n); set<string> dis; for (int i = 0; i < n; i++) { string s1; cin >> s; int len = s.size(); for (int j = len - 1; j >= 0; j--) { if (s[j] == ...
### Prompt Generate a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; set<string> nameSet; for (int i = 0; i < n; i++) { string name; string normalForm; cin >> name; for (int j = 0; j < name.size(); j++) { if (name[j] == 'u') normalForm += "oo"; else normalForm ...
### Prompt Please create a solution in Cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; string norm(string s) { int n = s.length(); string res; for (int i = 0; i < n; ++i) { if (s[i] == 'u') { res += "oo"; continue; } else if (s[i] != 'k') { res += s[i]; continue; } bool snap = false; for (int j = i + 1; j < n;...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; int n; string s; map<string, bool> vis; string biaozhun(string s) { bool flag; string aft = ""; for (int i = 0; i < s.size(); ++i) { if (s[i] == 'u') aft += "oo"; else if (s[i] == 'k') { flag = false; for (int j = i + 1; j < s.size(); ++j) { ...
### Prompt Your task is to create a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; long long i, j, n, c[223456], d[123456], l, ll, r, t, k, x, y, xx, yy, z, a[434568], m, b[445678]; string p, q, qq; double s; map<string, long long> u; int main() { cin >> n; while (n--) { cin >> p; t = 0; l = p.size(); while (t == 0) { q = qq;...
### Prompt Please formulate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; string s[n]; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++) { while (1) { int fl = 0; string pt; for (int j = 0; j < s[i].length(); j++) { if (s[i][j] == 'k' && s[i][j + 1] == 'h')...
### Prompt In CPP, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 405; int n; string s[MAXN]; bool has[MAXN]; int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) { cin >> s[i]; int l = s[i].length(); for (int j = 0; j < l; j++) { if (s[i][j] == 'u') { s[i] = s[i].substr(0, j) + string(...
### Prompt Your challenge is to write a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; int maxn = 1e9, minn = -1e9; long long modpow(long long base, long long exp, int modulus) { base %= modulus; long long result = 1; while (exp > 0) { if (exp & 1) result = (result * base) % modulus; base = (base * base) % modulus; e...
### Prompt Generate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; map<string, bool> m; string del(string s) { int i = 0; while (i < s.size()) { if (i < s.size() - 1 && s[i] == 'k' && s[i + 1] == 'h') { s.erase(s.begin() + i); i -= 2; } i++; if (i < 0) i++; } return s; } int main() { cin.tie(0); ios_...
### Prompt Construct a CPP code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> #pragma GCC optimize("-O3") using namespace std; const long long mod = 998244353; int n; string s[405]; void solve() { cin >> n; int ind = 0, fo; for (int i = 0; i < n; i++) { cin >> s[i]; ind = 0; fo = s[i].find("u", ind); while (fo < s[i].size()) { ind = fo + 2; ...
### Prompt Please create a solution in cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; string A; set<string> s; int n; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> A; bool p = false; string y = ""; for (int j = 0; j < A.size(); j++) { if (A[j] == 'u') ...
### Prompt Create a solution in Cpp for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; void chuanHoa(string &s) { while (s.find("kh") != -1) { int id = s.find("kh"); s.replace(id, 2, "h"); } while (s.find("u") != -1) { int id = s.find("u"); s.replace(id, 1, "oo"); } } int main() { int n; string s[401]; map<string, int> m; cin >...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; void mod1(long long int &a) { a %= 1000000007; } void mod2(long long int &a) { a %= 1000000007; if (a < 0) { a += 1000000007; } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); set<string> st; string s; int t, m, n, q; long l...
### Prompt Please create a solution in Cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; static inline void canhazfast() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); } template <typename T> T extgcd(T a, T b, T &x, T &y) { T x0 = 1, y0 = 0, x1 = 0,...
### Prompt Please provide a CPP coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; int main() { int n, j, k, t; cin >> n; char str[n][100]; char temp[100]; for (int i = 0; i < n; i++) { cin >> str[i]; for (j = 0, k = 0; j < strlen(str[i]);) { if (str[i][j] == 'u') { temp[k] = 'o'; temp[k + 1] = 'o'; j++; ...
### Prompt Develop a solution in cpp to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0; cin >> n; unordered_map<string, int> p; while (n--) { string s, c; cin >> s; char a[40] = {'\0'}; int l = s.length(), j = 0, k = 0; for (int i = 0; i < l; i++) { if (s[i] == 'u') { a[j] = 'o'; j+...
### Prompt Generate a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; int n; string ss[445]; set<string> sss; int main() { cin >> n; for (int i = 1; i <= n; ++i) { cin >> ss[i]; reverse(ss[i].begin(), ss[i].end()); string g = ""; bool ls = 0; for (int p = 0; p < ss[i].size(); ++p) { if (ss[i][p] == 'u') g...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXN = 400; const int MAXLEN = 20; int n; char s[MAXN][MAXLEN + 1]; char t[2 * MAXLEN + 1]; int tlen; set<string> all; void run() { scanf("%d", &n); for (int i = (0); i < (n); ++i) ...
### Prompt Please provide a cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; int main() { int sum, n; while (cin >> n) { sum = 1; string name[405]; string str; for (int i = 0; i < n; i++) { cin >> str; int len = str.size(); for (int j = len - 1; j >= 0; j--) { if (str[j] == 'o' && str[j - 1] == 'o') { ...
### Prompt Please provide a Cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; const int oo = 0x3f3f3f3f; const long long ooo = 9223372036854775807ll; const int _cnt = 1000 * 1000 + 7; const int _p = 1000 * 1000 * 1000 + 7; const int N = 100005; const double PI = acos(-1.0); const double eps = 1e-9; int o(int x) { return x % _p; } int gcd(int a, int b...
### Prompt In Cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; int n; char a[100]; long long x[500]; int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%s", a + 1); x[i] = 0; int len = strlen(a + 1), sum = 0; for (int j = 1; j <= len; j++) if (a[j] == 'k') ++sum; else if (a[j] ==...
### Prompt Please create a solution in cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; const int MAXL = 25; int _w; int n; char str[MAXL]; set<string> s; string solve(char *s, int n) { string str; int cntk = 0; for (int i = 0; i < n; ++i) { if (s[i] == 'u') { for (int t = 0; t < cntk; ++t) str += 'k'; cntk = 0; str += "oo"; } e...
### Prompt Generate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; string a[410]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { for (int j = a[i].size() + 1; j--;) { for (int l = 0; l < a[i].size(); l++) { if (a[i][l] == 'u') a[i].replace(l, 1, "oo")...
### Prompt Create a solution in cpp for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; char s[410][42]; char a[42], t[42]; int main() { int n; while (~scanf("%d", &n)) { int ans = n, g = 0; for (int k = 0; k < n; k++) { scanf("%s", t); while (true) { int k = 0; for (int i = 0; t[i] != '\0';) { if (t[i] == 'u')...
### Prompt Develop a solution in CPP to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; string Find(string s) { while (s.find("kh") < s.size()) s.replace(s.find("kh"), 2, "h"); while (s.find("u") < s.size()) s.replace(s.find("u"), 1, "oo"); return s; } int main() { string s; map<string, long long> ismap; long long n; cin >> n; for (int i = 0; i...
### Prompt Please create a solution in Cpp to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 1e4; map<string, bool> mp; string lower(string s) { string res; int l = s.size(); for (int i = l - 1; i >= 0; i--) { if (s[i] == 'u') { res = "oo" + res; } else if (s[i] == 'h') { while (i && s[i - 1] == 'k') i--; res =...
### Prompt Please formulate a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int n; int len = 0; char s[51]; int t = 1315326179; int mod = 19260817; unsigned long long ha[410]; long long h[410]; void change1(int pos) { len++; for (int i = len; i >= pos; i--) s[i] = s[i - 1]; s[pos] = 'o'; s[pos + 1] = 'o'; } void change2(int pos) { len--; ...
### Prompt Please formulate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; map<string, int> luu; string xau[500]; int n; string change_st(string s) { int found = s.find("u"); while (found != -1) { s.erase(found, 1); s.insert(found, "oo"); found = s.find("u"); } found = s.find("kh"); while (found != -1) { s.erase(found, 1)...
### Prompt Please formulate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; set<string> unique; for (int i = 0; i < n; i++) { string s; cin >> s; for (;;) { bool found = false; if (s == "u") s = "oo"; for (int j = 0; j < s.length() - 1; j++) { if (s.at(j) == 'k' and s.at(j ...
### Prompt Please formulate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int n; const int maxn = 405; char str[maxn][100]; set<string> st; int main() { scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%s", str[i] + 1); } for (int i = 1; i <= n; i++) { int len = int(strlen(str[i] + 1)); string aft; for (int j = 1; j ...
### Prompt Construct a CPP code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; int main() { int m; cin >> m; set<string> ff; for (int l = 0; l < m; ++l) { string s; cin >> s; string fuck; int n = s.size(); for (int i = 0; i < n;) { if (s[i] == 'k') { for (int j = i + 1; j < n; ++j) { if (s[j] == 'k')...
### Prompt Please create a solution in CPP to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; set<string> s; int count = 0; while (t--) { string str; cin >> str; for (int i = 0; i < str.length(); i++) { if (str[i] == 'h') { int j = i - 1; int k = i; while (j >= 0 && str[j] == 'k') j--;...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; set<string> s; int main() { int n, len; cin >> n; string name, str, temp; cin.clear(); cin.ignore(); for (int i = 0; i < n; i++) { cin >> name; str = ""; len = name.length(); int j, k; j = k = 0; for (int j = 0; j < len; j++) { if (...
### Prompt Your task is to create a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; int n; set<string> st; string s; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) { cin >> s; for (int i = 0; i < (int)s.length(); ++i) { while (s[i] == 'u') s = s.substr(0, i) + 'o' + 'o' + s.substr(i + 1, s.length() - i - 1); while...
### Prompt Develop a solution in CPP to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int n; string s; set<string> aux; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { cin >> s; string ns = ""; for (int j = 0; j < s.size(); j++) { if (s[j] == 'u') ns += "oo"; else if (s[j] == 'h') { while (!ns.empty() &...
### Prompt In Cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; long long int MOD = 1000000007; long long int inf = 1e15; void scan(int &x); long long int powermod(long long int _a, long long int _b, long long int _m) { long long int _r = 1; while (_b) { if (_b % 2 == 1) _r = (_r * _a) % _m; _b /= 2; _a = (_a * _a) % _m;...
### Prompt Construct a cpp code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> v; for (int i = 0; i < n; ++i) { string s; cin >> s; string s1; for (int j = s.size() - 1; j >= 0; --j) { if (s[j] == 'h') { s1 += 'h'; j--; while (s[j] == 'k') j--; +...
### Prompt Please formulate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; using namespace std; long long power(long long x, long long y) { long long temp = 1; while (y > 0) { if (y % 2 == 1) temp = (x * temp) % 1000000007; x = (x * x) % 1000000007; y = y / 2; } return temp; } long long n; string st; int main() { ios_base::sy...
### Prompt Construct a CPP code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; long long int powe(long long int n, long long int p, long long int x) { if (p == 0) return 1; if (p == 1) return n % x; if (p % 2 == 0) return (powe(n, p / 2, x) * powe(n, p / 2, x)) % x; return (((powe(n, p / 2, x) * powe(n, p / 2, x)) % x) * n) % x; } int main() {...
### Prompt Construct a CPP code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; int main() { set<string> S; long n; string a; cin >> n; for (long i = 0; i < n; i++) { cin >> a; string s = ""; long j = 0; while (j < a.size()) { if (a[j] == 'k') { long k = j; while (a[k] == 'k') k++; if (a[k] == 'h'...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; int main() { map<string, long long int> mpr; long long int n; cin >> n; for (long long int i = 1; i <= n; i++) { string s; cin >> s; string v = s + s; long long int len = 0; for (long long int i = 0; i < s.size(); i++) { if (s[i] == 'u') { ...
### Prompt In Cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; template <typename T> T scani(T &n) { n = 0; bool negative = false; char c = getchar(); while (c < '0' || c > '9') { if (c == '-') negative = true; c = getchar(); } while (c >= '0' && c <= '9') { n = n * 10 + c - 48; c = getchar(); } if (nega...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; char str[405][128]; char bufstr[128]; char bufstr2[128]; void red() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); } int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%s", str[i]); } for (int i = 0; i < n; i...
### Prompt Your task is to create a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; string s[500]; set<string> q; int n; int main() { while (cin >> n) { q.clear(); for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++) { int len = s[i].size(); string st; for (int j = 0; j < len; j++) { int flag = 0; ...
### Prompt Please provide a cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; map<string, int> mp; int main() { int i, j, n, m, t; string s; cin >> t; int cnt = 0; for (i = 0; i < t; i++) { cin >> s; int len = s.size(); string ans; int chk = 1; while (chk == 1) { ans.clear(); chk = 0; len = s.size(); ...
### Prompt Generate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; set<string> stk; string s[t]; for (int i = 0; i < t; ++i) { cin >> s[i]; } for (long long int i = 0; i < t; i++) { string pkp = "#"; for (long long int j = 0; j < s[i].size(); j++) { if (s[i][j] == 'u')...
### Prompt Please create a solution in CPP to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int toInt(string s) { int sm; stringstream second(s); second >> sm; return sm; } string create(char c, int seg) { string tt = ""; while (seg--) tt += c; return tt; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); set<string> myset; in...
### Prompt Your task is to create a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; map<string, int> ma; int main() { string str; char st[100]; char cnt[100]; int top = 0; int n; cin >> n; int sum = 0; for (int i = 1; i <= n; ++i) { scanf("%s", st); int len = strlen(st); str.clear(); top = 0; for (int i = 0; i < len; ++i...
### Prompt Please formulate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; set<string> s; for (int i = 0; i < n; i++) { string a; cin >> a; stack<char> q; for (int i = 0; i < a.size(); i++) { if (q.empty()) { q.push(a[i]...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; int n; int main() { while (cin >> n) { string s; set<string> st; while (n--) { cin >> s; for (int i = s.length(); i >= 0; i--) { if (s[i] == 'u') s.replace(i, 1, "oo"); else if (s[i] == 'k' && s[i + 1] == 'h') s....
### Prompt In cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; string a[1009]; int n; set<string> s; string h; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; for (int j = 0; j < a[i].size(); j++) { char l = a[i][j]; if (a[i][j] == 'u') { h += "oo"; } else if (a[i][j] == 'k') { ...
### Prompt Please provide a cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; int n; string s[500]; set<string> q; int main() { int i; cin >> n; for (i = 1; i <= n; i++) cin >> s[i]; for (i = 1; i <= n; i++) { int l = s[i].size(); int j = 0; string t; if (l == 1) { if (s[i][j] == 'u') t = "oo"; else ...
### Prompt Construct a CPP code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; string proc(char *a) { int n = strlen(a); char s[100]; int i = 0, j = 0; while (i < n) { if (a[i] == 'u') s[j++] = 'o', s[j++] = 'o'; else s[j++] = a[i]; i++; } s[j] = '\0'; strcpy(a, s); n = j; i = j = 0; while (i < n) { if (...
### Prompt Please provide a Cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; const int maxl = 50 + 5; set<string> st; int main() { ios_base::sync_with_stdio(false); int n, len, k, flag; string s1, s2, s3; cin >> n; for (int i = 0; i < n; i++) { cin >> s1; s2.clear(); len = s1.size(); k = 0; flag = 0; for (int j = le...
### Prompt Your task is to create a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 7; int n, k, c; string x; map<string, bool> name; int main() { cin >> n; for (int i = 0; i < n; i++) { k = 0; string y; cin >> x; for (int j = 0; j < x.length(); j++) { if (x[j] == 'k') k++; else if (x[j] == 'h') ...
### Prompt Please formulate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cin.ignore(INT_MAX, '\n'); vector<string> vec; string temp; for (int i = 0; i < n; i++) { cin >> temp; vec.push_back(temp); } set<string> st; string s; for (long int j = 0; j < vec.size(); j++) { s = vec[j]; ...
### Prompt Please provide a cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; string canonical_form(string s) { string ans; int n = s.size(); for (int i = 0; i < n;) { if (s[i] == 'u') { ans += "oo"; i++; } else if (s[i] == 'k') { int len = 0; while (s[i] == 'k') { len++; i++; } if (s[...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; template <typename T> inline void Int(T &n) { n = 0; int f = 1; register int ch = getchar(); for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1; for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0'; n = n * f; } template <typename T...
### Prompt Please provide a Cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> #pragma optimize("Ofast") using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; unordered_map<string, int> um; for (int i = 0; i < n; i++) { string s; cin >> s; string t = ""; int n = s.length(); int cnt_k = 0; for (in...
### Prompt Your challenge is to write a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9 + 7; const int N = 1e6 + 10; string check(string &str) { string ret; for (auto &c : str) { if (c == 'h') { while (!ret.empty() && ret.back() == 'k') ret.pop_back(); ret.push_back('h'); } else if (c == 'u') { ret.push_b...
### Prompt Your challenge is to write a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; int main() { long long int t, n, i, j, a, b; cin >> t; set<string> st; vector<string> vect; for (j = 0; j < t; j++) { string tp; cin >> tp; vect.push_back(tp); for (i = tp.size() - 1; i > 0; i--) { if (tp[i - 1] == 'k' && tp[i] == 'h') { ...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; const int inf32 = 1e8 + 9; const long long inf64 = 1e18 + 18; const int N = 402; set<string> st; int main() { int n, j; string s, rez; cin >> n; for (int i = 0; i < n; ++i) { cin >> s; rez.clear(); for (j = 0; j < s.length(); ++j) { if (s[j] == 'k'...
### Prompt Develop a solution in cpp to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { set<string> res; int n; cin >> n; string names[n]; for (int i = 0; i < n; i++) cin >> names[i]; string s; for (int i = 0; i < n; i++) { for (int j = names[i].length() - 1; j >= 0; j--) { if (names[i][j] == 'u') s += "oo"; e...
### Prompt Please provide a CPP coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string G[420]; for (int i = 0; i < n; i++) { string s; cin >> s; G[i] = s; } int ans = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < G[i].size(); j++) { if (G[i][j] == 'u') { G[i][j] = 'o'; ...
### Prompt Create a solution in cpp for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; map<string, bool> ma; map<string, bool>::iterator pos; int n, len, ans; string s, ss; int main() { scanf("%d\n", &n); ma.clear(); ans = 0; while (n--) { cin >> s; len = s.length(); while (s[len - 1] > 'z' || s[len - 1] < 'a') len--; s = s.substr(0, l...
### Prompt Please formulate a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; set<string> st; for (int i = 1; i <= n; i++) { cin >> s; string cur = ""; for (auto e : s) { if (e == 'u') { cur += "oo"; } else if (...
### Prompt Develop a solution in Cpp to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; const int N = 666; string modify(string s) { string now = ""; int n = s.size(); for (int i = 0; i < n; ++i) { if (s[i] == 'u') { now += 'o'; now += 'o'; } else now += s[i]; } s = now; n = s.size(); string res = ""; for (int i = 0; i...
### Prompt Please provide a cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; int n; char a[30], b[30]; int la, lb; set<pair<long long, long long> > s; int ans; int flag, un, on, kn; void Sol() { if (flag == -1) { for (int k = 0; k < un; k++) b[lb++] = 'u'; for (int k = 0; k < (on >> 1); k++) b[lb++] = 'u'; if (on & 1) b[lb++] = 'o'; ...
### Prompt Create a solution in cpp for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; map<string, bool> ma; char s[45]; int main() { int n; cin >> n; for (int i = 1; i <= n; i++) { scanf("%s", s + 1); int len = strlen(s + 1); for (int j = 1; j <= 20; j++) { for (int k = 1; k <= len; k++) { if (s[k] == 'u') { s[k] = '...
### Prompt Please create a solution in CPP to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; set<string> Set; string s; int n, i; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; while (n--) { cin >> s; while (s.find("kh") != string::npos) s.erase(s.find("kh"), 1); for (i = 0; i < s.size(); i++) if (s[i] == 'u') { s.eras...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; int n, k; string s; set<string> st; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> s; for (int i = 0; i < s.size(); i++) { if (s.substr(i, 1) == "u") s.replace(i, 1, "oo"); if (s.substr(i, 2) == "kh") s.replace(i, 2, "h"), i -= 2; ...
### Prompt Your challenge is to write a CPP solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; string s; map<string, int> mp; map<string, int>::iterator itor; int lth, n, ans, it, tmp, tlen; char tmp_s[100], tmp_a[100]; void mv() { tmp = 0; for (int i = 0; i < lth; ++i) { if (s[i] == 'u') { tmp_s[tmp++] = 'o'; tmp_s[tmp++] = 'o'; } else ...
### Prompt Your task is to create a cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and...
#include <bits/stdc++.h> using namespace std; bool debug = 1; long long MOD = 1e9 + 7; set<string> ss; int n; int main() { scanf("%d", &n); string s; for (int i = 0; i < n; i++) { cin >> s; string scur; int id = 0; while (id < s.size()) { if (s[id] == 'k') { int pivo = id; bo...
### Prompt Create a solution in CPP for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; int main() { int n; set<string> st; string s, t, t1; cin >> n; while (n--) { cin >> s; t = s; for (int i = 0; i < s.size(); i++) { if (s[i] == 'u') { t = t1 = ""; t.assign(s, 0, max(0, i)); t1.assign(s, min(i + 1, (int)s.s...
### Prompt In cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<string> v(n); for (auto& s : v) cin >> s; int max_kh = 0; for (auto s : v) { int ctr = 0; for (aut...
### Prompt Create a solution in cpp for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; template <typename T> void print_array(T* arr, int num) { for (int(i) = (0); (i) < (num); (i)++) cout << arr[i] << ' '; cout << '\n'; } template <typename T> void print_vector(vector<T> vec) { for (int(i) = (0); (i) < (vec.size()); (i)++) cout << vec[i] << ' '; cout...
### Prompt Construct a cpp code solution to the problem outlined: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string str; map<string, int> m; while (n--) { cin >> str; int x = str.find('u'); while (x <= str.size()) { str.replace(x, 1, "oo"); x = str.find('u'); } int y = str.find("kh"); while (y <= str.size(...
### Prompt In cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; const double eps = 0.000000000000001; void transoo(char *s) { int i, j, l = strlen(s); char t[200] = {0}; int p = 0; for (i = 0; i < l; i++) { if (!(s[i] == 'u')) { t[p++] = s[i]; } else { t[p++] = 'o'; t[p++] = 'o'; } } t[p] = 0; ...
### Prompt In Cpp, your task is to solve the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int k, n, m, x, ans; int a[N]; string second, r; map<string, int> vis1, vis2; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { char e[50]; scanf("%s", e); r = second = e; while (second.find("kh") != -1) { x = secon...
### Prompt Please provide a cpp coded solution to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana"...
#include <bits/stdc++.h> using namespace std; char str[500][50]; set<string> key; int main() { int n; while (scanf("%d", &n) != EOF) { for (int i = 0; i < n; i++) { scanf("%s", str[i]); int ss = 0; int len = strlen(str[i]); for (int j = 0; j < len; j++) { if (str[i][j] == 'o' || ...
### Prompt Generate a Cpp solution to the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" den...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; using pdd = pair<double, double>; using vi = vector<int>; using vii = vector<pii>; using vs = vector<string>; const double PI = acos(-1.0); const double EPS = 1e-14; const int MOD = 1e9 + 7; const i...
### Prompt Develop a solution in CPP to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string s[n]; for (int i = 0; i < n; i++) cin >> s[i]; for (int i = 0; i < n; i++) { string temp = ""; int l = (int)s[i].size(); int j = 0; while (j < l) { ...
### Prompt Develop a solution in CPP to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...
#include <bits/stdc++.h> using namespace std; vector<string> strs; string process(string base) { int pos = base.find("u"); while (pos != -1) { base = base.substr(0, pos) + "oo" + base.substr(pos + 1, (int)base.size() - (pos + 1)); pos = base.find("u"); } pos = base.find("oo"); while (pos !=...
### Prompt Create a solution in cpp for the following problem: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "oolyana" d...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n; cin >> n; string arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; for (int j = 0; j < arr[i].length(); j++) { if (arr[i][j] == 'k' && arr[i][j + 1] == 'h') { arr[i].erase(j, 1); j =...
### Prompt Develop a solution in cpp to the problem described below: There are some ambiguities when one writes Berland names with the letters of the Latin alphabet. For example, the Berland sound u can be written in the Latin alphabet as "u", and can be written as "oo". For this reason, two words "ulyana" and "ooly...