NOIP2010年第十六届普及组初赛阅读程序写结果题:
#include <iostream> #include <string> usingnamespacestd; int main() { string s; char m1, m2; int i; getline(cin, s); m1 = ' '; m2 = ' '; for (i = 0; i < s.length(); i++) if (s[i] > m1) { m2 = m1; m1 = s[i]; } elseif (s[i] > m2) m2 = s[i]; cout<<int(m1)<<' '<<int(m2)<<endl; return0; }
输入:Expo 2010 Shanghai China
输出:_________
提示: