The TransCompilator

Solved LeetCode program · 766 of 1,000

#1002 · Find Common Characters

Easy Array chunk-16.md

Original English source

Keep a shared words as an empty list of text. Keep a shared alphabet as empty text. Keep a shared tally of 0. Place "bella" into words. Place "label" into words. Place "roller" into words. Place "abcdefghijklmnopqrstuvwxyz" into alphabet.

To measure from index (a whole number) with letter (a whole number). The word is item index of words. The symbol is the slice of alphabet from letter to letter plus 1. Set tally to 0.
For every spot from 0 to the last position of word.
The piece is the slice of word from spot to spot plus 1. If piece matches symbol, add 1 to tally.

The least is a list of 26 zeros.
For every letter from 0 to 25.
The smallest is 100.
For every index from 0 to 2.
Measure from index with letter. If tally is less than smallest, set smallest to tally. If index is 2, set item letter of least to smallest.

The found is an empty list of text.
For every letter from 0 to 25.
For every copy from 0 to item letter of least minus 1.
The piece is the slice of alphabet from letter to letter plus 1. Place piece into found.

The line is empty text.
For each piece in found.
If the length of line is more than 0, Place "," into line. Place piece into line.

Show line.

Open in Playground Browse all 1,000 problems

Expected stdout

e,l,l