Вопрос задан 07.11.2018 в 00:40. Предмет Информатика. Спрашивает Виноградова Кристина.

ABCpaskal: Дана строка символов.Определить,можно ли из символов данной строки получить слово лес???

Помогите пожалуйста)))!!!
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Гаврикова Мария.
Var
  s: string;
begin
  readln(s);
  if (Pos('л',s)>0) and (Pos('е',s)>0) and (Pos('с',s)>0)  then
  writeln('Можно') else writeln('Нельзя')
end.
0 0
Отвечает Тимошенко Вика.
Несомненно, пользователь Yuliagal правильно сделала задание. Я оставлю свой ответ здесь, если вдруг кто-нибудь не понял, как это задание можно выполнить.
var  st: string; l, e, s: integer;
begin 
readln(st); 
l := pos('л', st);//Находим позицию символа л 
e := pos('е', st);//Находим позицию символа е 
s := pos('с', st);//Находим позицию символа с 
if (l = 0) or (e = 0) or (s = 0) then writeln('Составить слово лес нельзя.'); //Если символ не был найден, то ему присваивается значение равное 0, следовательно, дальнейшее выполнение программы бессмысленно. 
if (l > 0) and (e > 0) and (s > 0) then writeln('Можно составить слово: ', copy(st, l, 1) + copy(st, e, 1) + copy(st, s, 1)); //Если символ найден, ему присваивается значения, равное позиции в строке. Далее выводим на печать символы, расположенные в этих позициях.
end.
Еще раз повторюсь, решение 
Yuliagal верное, и самое короткое.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Can the word "лес" be formed from the characters in a given string?

To determine if the word "лес" can be formed from the characters in a given string, we need to check if the string contains the necessary characters in the correct order.

Here's a step-by-step approach to solving this problem:

1. Identify the necessary characters: The word "лес" consists of the characters 'л', 'е', and 'с'.

2. Check if the string contains all the necessary characters: Iterate through each character in the string and check if it matches any of the necessary characters. Keep track of the order of the characters found.

3. Verify the order of the characters: Once all the necessary characters are found, check if they appear in the correct order. In this case, the order should be 'л', 'е', and 'с'.

4. Return the result: If all the necessary characters are found in the correct order, return "Yes, the word 'лес' can be formed from the characters in the given string." Otherwise, return "No, the word 'лес' cannot be formed from the characters in the given string."

Let's apply this approach to the given string:

Given string: ABCpaskal

1. Necessary characters: 'л', 'е', 'с' 2. Iterating through the given string, we find the characters 'a', 's', and 'k'. None of these characters match the necessary characters. 3. Since none of the necessary characters are found, we cannot form the word "лес" from the given string.

Therefore, the answer is: No, the word 'лес' cannot be formed from the characters in the given string.

Please let me know if you have any further questions!

0 0

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

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

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