Home
О нас
Products
Services
Регистрация
Войти
Поиск
all199927
@all199927
July 2022
1
3
Report
Дана строка. Найти и напечатать все слова в этой строке , которые являются палиндромами.Програмирование
Please enter comments
Please enter your name.
Please enter the correct email address.
Agree to
terms of service
You must agree before submitting.
Send
Answers & Comments
marick0073
На Java:
class SearchPalin{
public static void main(String args[]){
String palinString = new java.util.Scanner(System.in).nextLine();
System.out.print("\nПалиндром(-ы):\n ");
for(int wordStart = 0, wordEnd = 0; wordEnd<palinString.length(); wordEnd++)
if(wordEnd+1==palinString.length() || palinString.charAt(wordEnd+1)==' '){
String wordBeginning = "", wordEnding = "";
for(int wordBe = wordStart;wordBe<wordEnd+1;wordBe++)wordBeginning+=palinString.charAt(wordBe);
for(int wordEn = wordEnd;wordStart-1<wordEn;wordEn--)wordEnding+=palinString.charAt(wordEn);
if(wordBeginning.equals(wordEnding)){
for(int palinWord = wordStart;palinWord<=wordEnd;palinWord++)System.out.print(palinString.charAt(palinWord));
System.out.print("\n ");
} wordStart = wordEnd+2;
}
}
}
0 votes
Thanks 0
More Questions From This User
See All
all199927
July 2022 | 0 Ответы
napishite uravneniya reakcij metan gtalfa aminomaslyanaya kislota
Answer
all199927
July 2022 | 0 Ответы
nazovite sleduyushie veshestva po mezhdunarodnoj nomenklature
Answer
all199927
July 2022 | 0 Ответы
na vhod programme podayutsya svedeniya iz kakih shkol ucheniki ne sdali knigi v bibl
Answer
all199927
September 2021 | 0 Ответы
na vhod programmy podayutsya proizvolnye alfavitno cifrovye simvoly progrmirovan
Answer
рекомендуемые вопросы
rarrrrrrrr
August 2022 | 0 Ответы
o chem dolzhny pozabotitsya v pervuyu ochered vzroslye pri organizacionnom vyvoze n
danilarsentev
August 2022 | 0 Ответы
est dva stanka na kotoryh vypuskayut odinakovye zapchasti odin proizvodit a zapcha
myachina8
August 2022 | 0 Ответы
najti po grafiku otnoshenie v3v1 v otvetah napisano 9 no nuzhno reshenie
ydpmn7cn6w
August 2022 | 0 Ответы
Choose the correct preposition: 1.I am fond (out,of,from) literature. 2.where ar...
millermilena658
August 2022 | 0 Ответы
opredelite kak sozdavalas i kto sozdaval arabskoe gosudarstvo v kracii
MrZooM222
August 2022 | 0 Ответы
ch ajtmanov v rasskaze krasnoe yabloko ispolzuet metod rasskaz v rasskaze opi
timobila47
August 2022 | 0 Ответы
kakovo bylo naznachenie kazhdoj iz chastej vizantijskogo hrama pomogite pozhalujsta
ivanyyaremkiv
August 2022 | 0 Ответы
moment. 6....
pozhalujsta8b98a56c0152a07b8f4cbcd89aa2f01e 97513
sarvinozwakirjanova
August 2022 | 0 Ответы
pomogite pozhalusto pzha519d7eb8246a08ab0df06cc59e9dedb 6631
×
Report "Дана строка. Найти и напечатать все слова в этой строке , которые являются палин..."
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Helpful Links
О нас
Политика конфиденциальности
Правила и условия
Copyright
Контакты
Helpful Social
Get monthly updates
Submit
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
class SearchPalin{
public static void main(String args[]){
String palinString = new java.util.Scanner(System.in).nextLine();
System.out.print("\nПалиндром(-ы):\n ");
for(int wordStart = 0, wordEnd = 0; wordEnd<palinString.length(); wordEnd++)
if(wordEnd+1==palinString.length() || palinString.charAt(wordEnd+1)==' '){
String wordBeginning = "", wordEnding = "";
for(int wordBe = wordStart;wordBe<wordEnd+1;wordBe++)wordBeginning+=palinString.charAt(wordBe);
for(int wordEn = wordEnd;wordStart-1<wordEn;wordEn--)wordEnding+=palinString.charAt(wordEn);
if(wordBeginning.equals(wordEnding)){
for(int palinWord = wordStart;palinWord<=wordEnd;palinWord++)System.out.print(palinString.charAt(palinWord));
System.out.print("\n ");
} wordStart = wordEnd+2;
}
}
}