Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

Viewed less than a minute ago

LIv7z5OtceqBvxay

C++ gcc 12.1.0

Created at 1 minute ago

Created by anonymous

Author

anonymous

1 minute ago

Language

C++

Compiler

gcc 12.1.0

Options
Warnings
Don't Use Boost
C++11
no pedantic
セオライド・テクノロジー㈱株式会社フィックスターズ

Author

anonymous

1 minute ago

›
⌄
⌄
⌄
⌄
⌄
⌄
⌄
⌄
⌄
99
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <bits/stdc++.h>
using namespace std;
string s, s1, s2;
vector <string> a;
bool cmp(string x, string y){
if(x.size()!=y.size()) return x.size() < y.size();
else{
for(int i=0; i<x.size(); i++){
if(x[i]!=y[i]) return x[i]<y[i];
}
}
return false;

}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> s;
s=s+' ';
int i=0;
while(i<s.length()){
if(isdigit(s[i])){
//a.push_back(s2);
//s2="";
s1+=s[i];
i++;
}
else{
//s2+=s[i];
a.push_back(s1);
s1="";
i++;
}
}
;
sort(a.begin(), a.end(), cmp);
cout << a[1];
//for(int x=0; x<a.size(); x++) cout << a[x];
//int j = 0;
cout << s[0];
for(int x=1; x<s.size()-1; x++){
/*if(isdigit(s[x])&&isdigit(s[x-1])==false){
cout << a.front();
}*/
if(isdigit(s[x])==false) {cout << s[x];}
}

return 0;
}
›
9
1
3,2,1,0
$ g++ prog.cc -Wall -Wextra -std=c++11
prog.cc: In function 'bool cmp(std::string, std::string)':
prog.cc:8:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |             for(int i=0; i<x.size(); i++){
      |                          ~^~~~~~~~~
prog.cc: In function 'int main()':
prog.cc:21:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     while(i<s.length()){
      |           ~^~~~~~~~~~~
prog.cc:41:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int x=1; x<s.size()-1; x++){
      |                  ~^~~~~~~~~~~
13,,,
Exit Code:
0
セオライド・テクノロジー㈱株式会社フィックスターズ