#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <unordered_map>
using namespace std;
/*解題思路:*/
int main() {
string abc;
cin >> abc; //輸入字符串a(chǎn)bc
string str(abc);
string::iterator it; //迭代器it
for (it = str.begin(); it != str.end(); ++it) {
if ((*it == 'R') && (*(it + 1) == 'E') && (*(it + 2) == 'D')) {
str.erase(it); //刪除it處的一個字符(it是個string類型的迭代器)
str.erase(it);
str.erase(it);
}
}
cout << str << endl;
string tmp;
string max = "0";
for (it = str.begin(); it <= str.end(); ++it) {
cout << tmp << endl;
if (it == str.end()) {
break;
}
if ((*it >= '0') && (*it <= '9')) {
tmp = tmp + *it;
} else {
if (tmp.length() > max.length())
max = tmp;
else if (tmp.length() == max.length()) {
if (tmp > max)
max = tmp;
}
tmp.clear();
}
}
if (tmp.length() > max.length())
max = tmp;
else if (tmp.length() == max.length()) {
if (tmp > max)
max = tmp;
}
if (max == "0")
max = -1;
cout << max << endl;
return 0;
}
小紅書-RED密碼-c++
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
- 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來签舞,“玉大人秕脓,你說我怎么就攤上這事∪宕睿” “怎么了吠架?”我有些...
- 文/不壞的土叔 我叫張陵,是天一觀的道長搂鲫。 經(jīng)常有香客問我傍药,道長,這世上最難降的妖魔是什么? 我笑而不...
- 正文 為了忘掉前任拐辽,我火速辦了婚禮拣挪,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘俱诸。我一直安慰自己菠劝,他們只是感情好,可當(dāng)我...
- 文/花漫 我一把揭開白布乙埃。 她就那樣靜靜地躺著闸英,像睡著了一般。 火紅的嫁衣襯著肌膚如雪介袜。 梳的紋絲不亂的頭發(fā)上甫何,一...
- 文/蒼蘭香墨 我猛地睜開眼渐排,長吁一口氣:“原來是場噩夢啊……” “哼炬太!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起驯耻,我...
- 正文 年R本政府宣布,位于F島的核電站赃阀,受9級特大地震影響霎肯,放射性物質(zhì)發(fā)生泄漏擎颖。R本人自食惡果不足惜,卻給世界環(huán)境...
- 文/蒙蒙 一观游、第九天 我趴在偏房一處隱蔽的房頂上張望搂捧。 院中可真熱鬧,春花似錦懂缕、人聲如沸允跑。這莊子的主人今日做“春日...
- 文/蒼蘭香墨 我抬頭看了看天上的太陽聋丝。三九已至,卻和暖如春工碾,著一層夾襖步出監(jiān)牢的瞬間弱睦,已是汗流浹背。 一陣腳步聲響...
推薦閱讀更多精彩內(nèi)容
- 不知不覺地沮,工作已快兩年嗜浮,我不得不感嘆時間如流水。那股學(xué)生味仍雖散去摩疑。 兩年前危融,我跌跌撞撞地進(jìn)了銀行,回到了老家雷袋,光...
- 在整個英雄聯(lián)盟主播界吉殃,我個人感覺只有兩個主播是可以被稱之為劃時代級的主播。 他們分別是大司馬,小智蛋勺,盧本偉瓦灶。 小智...