1 solutions
-
0
C :
#include<stdio.h> #include<string.h> char c[255],b[255],a[255]; int max=-1; int main() { gets(c); int len=strlen(c); for(int i=0;i<len;i++) { if(c[i]!=' ') { int count=0; for(;i<len&&c[i]!=' ';i++) b[++count]=c[i]; if(count>max) { for(int j=1;j<=count;j++) a[j]=b[j]; max=count; } } } for(int i=1;i<=max;i++) printf("%c",a[i]); return 0; }
Python :
str = input() maxStr = ""; #存放长度最长的单词 k = 0 #存放最长单词的长度 li = str.split(" "); for i in range(0,len(li)): f = True for j in range(i + 1,len(li)): if len(li[i]) < len(li[j]): f = False; x = 1 break; if f: print(li[i]) break;
- 1
Information
- ID
- 10713
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By