fork download
  1. #include<iostream>
  2. #include<vector>
  3. #include<algorithm>
  4. #define b v.begin()
  5. using namespace std;int main(){vector<int>v;int x,n=0;for(;cin>>x;++n)v.push_back(x);for(x=n;x--;rotate(b,b+1,b+n))if(is_sorted(b,b+n)){for(x:v)cout<<x<<' ';return 0;}cout<<'-';}
Success #stdin #stdout 0s 3416KB
stdin
7 10 2 3 4
stdout
2 3 4 7 10