提交时间:2023-11-18 09:03:04
运行 ID: 110999
# include <bits/stdc++.h> using namespace std ; string s ; bool chk ( int l , int r ) { for ( int i = l ; i < r ; i ++ ) { if ( s [i] > s [i + 1] ) { return false ; } } return true ; } int main ( ) { cin >> s ; for ( int i = 1 ; i < s . size ( ) - 1 ; i ++ ) { for ( int j = i + 1 ; j < s . size ( ) ; j ++ ) { if ( chk ( i , j ) ) { for ( int k = i ; k <= j ; k ++ ) { cout << s [k] ; } cout << endl ; } } } return 0 ; }