fork download
  1. function identifiers(text, IDN) {
  2. const separators = '.,;:!?()[]\'"–-';
  3. for (let s of separators) {
  4. text = text.split(s).join(' ');
  5. }
  6. const slova = text.split(/\s+/);
  7. for (let slovo of slova) {
  8. if (slovo.length > 0 && ['I', 'Y', 'K', 'L', 'M', 'N'].includes(slovo[0].toUpperCase())) {
  9. IDN.push(slovo);
  10. }
  11. }
  12. }
  13. const text = `Ukraine[a] is a country in Eastern Europe. It is the second-largest country in Europe after Russia, which borders it to the east and northeast.[b] Ukraine also borders Belarus to the north; Poland and Slovakia to the west; Hungary, Romania and Moldova[c] to the southwest; and the Black Sea and the Sea of Azov to the south and southeast.[d] Kyiv is the nation's capital and largest city, followed by Kharkiv, Odesa, and Dnipro. Ukraine's official language is Ukrainian`;
  14. const IDN = [];
  15. identifiers(text, IDN);
  16. console.log("Ідентифікатори змінних, які починаються з букв I, Y, K, L, M або N:");
  17. console.log(IDN);
Success #stdin #stdout 0.04s 17584KB
stdin
Standard input is empty
stdout
Ідентифікатори змінних, які починаються з букв I, Y, K, L, M або N:
is,in,It,is,largest,in,it,northeast,north,Moldova,Kyiv,is,nation,largest,Kharkiv,language,is