Задана строка символов. Группы символов, разделенные пробелом и не содержащие пробелов внутри себя, будем называть словами. Найти количество слов в строке, у которых первый и последний символ совпадают.
Var currentPos,wordsAmount:byte; groupWords:string; procedure isCorrect(startPos:byte); begin while currentPos+1<=length(groupWords) do<br> if groupWords[currentPos+1]<>' ' then inc(currentPos) else break; if groupWords[startPos]=groupWords[currentPos] then inc(wordsAmount); end; begin readln(groupWords); wordsAmount:=0; currentPos:=1; while currentPos<=length(groupWords) do<br> begin if (groupWords[currentPos]<>' ') then isCorrect(currentPos); inc(currentPos); end; writeln(wordsAmount); readln; end.