# FOOLFORM Editorial

Author: Amul Agarwal
Testers: Ishaan Shah, Sanyam Shah, Sambasai Andem and Tejas Chaudhari
Editorialist: Keyur Chaudhari

SIMPLE/MEDIUM

# EXPLANATION:

The problem statement had a link to the same page as the problem. This hint was supposed to indicate recursion. This problem was based on the concept of " Recursive acronym".
A Recursive acronym is an acronym that refers to itself.

Examples:
PIP — PIP Installs Packages
GNU— GNU’s Not Unix

In this problem, we had to check if the sequence of strings given forms a pattern similar to a recursive acronym. The solution was to print “YES” if the string formed by the first characters of all given strings was also present in the list of strings given, and “NO” otherwise.

Another hint given in the problem: The problem code was “FOOLFORM” which could have hinted at “FULL FORM”

Sample Explanation

### Sample Input:

1
5
eve visited every royal yacht

YES

### Explanation:

String formed from first characters = “every”
Since “every” is present in the input, the answer is “YES”

Tester's Solution
``````#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fast                      \
ios_base::sync_with_stdio(0); \
cin.tie(0);                   \
cout.tie(0)
#define tc    \
int t;    \
cin >> t; \
while (t--)

signed main()
{
fast;
tc
{
int n;
cin >> n;
string a[n];
string trgt;
for (int i = 0; i < n; i++) {
cin >> a[i];
trgt.pb(a[i][0]);
}
int f = 0;
for (int i = 0; i < n; i++) {
if (a[i] == trgt) {
f = 1;
break;
}
}
if (f) {
cout << "YES" << endl;
}
else {
cout << "NO" << endl;
}
}
}

``````

Editorialist's Solution
``````#include <bits/stdc++.h>

#include <iostream>
using namespace std;

int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
vector<string> v(n);
string req = "";
for (int i = 0; i < n; i++) {
cin >> v[i];
req += v[i][0];
}
bool okay = false;
for (auto s1 : v) {
if (s1.size() != req.size()) continue;
if (req == s1) {
okay = true;
break;
}
}
if (okay)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
return 0;
}
``````