[Offer收割]编程练习赛54 register

Ended

Participants:154

Verdict:Accepted
Score:100 / 100
Submitted:2018-04-08 12:16:55

Lang:G++

Edit
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
#include <iostream>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <string.h>
#include <set>
#include <map>
#include <queue>
using namespace std;
typedef pair<int,int> pa;
typedef long long ll;
const int inf=(1<<30);
const int maxn=100005;
char t[500000];
void solve(){
    scanf("%s",t);
    int len=strlen(t);
    int a=0,b=len-1;
    while(a<b){
        if(t[a]!=t[b]) break;
        a++,b--;
    }
    while(t[a-1]==t[a]) a--;
    printf("%d",a+1);
}
int main(){
    solve();
    return 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX