注意该解题方法并不优秀
有代码过长和代码冗余的缺点,仅作为AC代码参考,可能后期会修改。
#include "bits/stdc++.h"
using namespace std;
#define INPUT_ERROR (-1)
#define INPUT_OVER (1)
#define MAX_LENGTH 105
#define MATCH_MAX_SIZE 3
char upLine[MAX_LENGTH];
char downLine[MAX_LENGTH];
int upLineLen,downLineLen;
int maxLength,sumLength;
int InputAllLine();
int GetNumberInCharArray(char ArrayName[],int pos);
int GetLengthOfUpMove();
int GetLengthOfDownMove();
int main(){
while (InputAllLine() != INPUT_ERROR){
int LenUpMove = GetLengthOfUpMove();
int LenDownMove = GetLengthOfDownMove();
int minLen = min(LenUpMove,LenDownMove);
printf("%d\n", minLen);
}
}
int InputAllLine(){
memset(upLine,'\0',MAX_LENGTH);
memset(downLine,'\0',MAX_LENGTH);
if (scanf("%s %s",downLine,upLine) != 2){
return INPUT_ERROR;
}
upLineLen =