ВУЗ:
Составители:
Рубрика:
42
class TaskClass {
public string str;
public bool needDelWord(string word) {
return word.Contains('a');
}
private bool isSeparator(char c) {
string oneCharStr = "" + c;
return " .,?!".Contains(oneCharStr);
}
public int getWordLength(int index) {
int res = 0;
for (int i = index; i < str.Length; i++) {
if (isSeparator(str[i])) {
break;
}
res = res + 1;
}
return res;
}
public void processString() {
for (int i = 0; i < str.Length; i++) {
if (isSeparator(str[i])) {
continue;
}
int len = getWordLength(i);
string word = str.Substring(i, len);
if (needDelWord(word)) {
str = str.Remove(i, len);
} else {
i = i + len;
}
}
}
public void mainAction() {
str = Console.ReadLine();
Console.WriteLine("Строка до обработки: " + str);
processString();
Console.WriteLine("Строка после обработки: " + str);
Console.ReadKey();
}
}
}
Страницы
- « первая
- ‹ предыдущая
- …
- 40
- 41
- 42
- 43
- 44
- …
- следующая ›
- последняя »
