Вопрос задан 18.02.2019 в 06:29. Предмет Информатика. Спрашивает Сысоев Артур.

Дана строка,содержащая английский текст.Найти количество слов,начинающихся с буквы d.

0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Налимова Оля.
Var 
s: string; 
p, nb: integer; 
begin 
write('text? '); 
readln(s); 
p := 1; 
while p <= length(s) do begin 
while (s[p] = ' ') and (p <= length(s)) do inc(p); 
if (p <= length(s)) and (s[p] = 'b') then inc(nb); 
while (s[p] <> ' ') and (p <= length(s)) do inc(p); 
end; 
write('num words: ', nb); 
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Finding the Number of Words Starting with 'd'

To find the number of words in a given English text that start with the letter 'd', we can use Python to count the occurrences of such words.

The Python code to achieve this is as follows:

```python import re

text = "Your English text goes here" # Replace this with the actual English text words_starting_with_d = re.findall(r'\b[dD]\w+', text) number_of_words_starting_with_d = len(words_starting_with_d) print(number_of_words_starting_with_d) ```

This code uses the `re` module to find all words that start with the letter 'd' (case-insensitive) in the given text and then counts the occurrences.

The result will be the number of words starting with 'd' in the given text.

Note: Replace `"Your English text goes here"` with the actual English text for which you want to find the number of words starting with 'd'.

Let me know if you need further assistance!

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос