#K91462. Longest Word Extraction

    ID: 37981 Type: Default 1000ms 256MiB

Longest Word Extraction

Longest Word Extraction

Given an input string, extract the longest word consisting only of alphanumeric characters and underscores. If two words have the same maximum length, return the first occurrence. If the input string is empty or equals "None", output "None".

You can view the extraction criteria as follows: for a string \(S\), a valid word is defined as a maximal contiguous segment \(S[i...j]\) such that every character \(S[k]\) (with \(i \leq k \leq j\)) matches the regular expression [\w]. The task is to find the word that maximizes \(j-i+1\).

inputFormat

The input consists of a single line read from standard input representing the string \(S\). If \(S\) is empty or exactly "None", then the expected output is "None".

outputFormat

Output the longest valid word extracted from the input string. If the input is empty or "None", print "None".

## sample
The quick brown fox jumped over the lazy dog
jumped