点击跳转例题
知识点:字符串总结
注意事项在代码中
#include <bits/stdc++.h> #define int long long //(有超时风险) #define PII pair<int,int> #define endl '\n' #define LL __int128using namespace std;const int N=2e6+10,M=1e3+10,mod=998244353,INF=0x3f3f3f3f;int a[N],b[N],c[N],pre[N];signed main() {std::ios::sync_with_stdio(false);std::cin.tie(nullptr);string s;cin>>s;string str[]={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};//表示第0位开始3个字符//判断月份string tmp=s.substr(0,3);for(int i=0;i<12;i++){if(str[i]==tmp)cout<<i+1<<' ';}//第3位开始到最后得字符串//判读日string ans=s.substr(3);for(int i=0;i<ans.size();i++){if(i==0&&ans[i]=='0')continue;cout<<ans[i];}return 0; }